LogInViewModel.cs 836 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using ReactiveUI;
  4. namespace Perspex.Xaml.Base.UnitTest.SampleModel
  5. {
  6. public class LogInViewModel : ReactiveObject
  7. {
  8. private string _username;
  9. public LogInViewModel()
  10. {
  11. OkCommand = ReactiveCommand.Create(
  12. this.WhenAnyValue(
  13. x => x.Username,
  14. x => !string.IsNullOrWhiteSpace(x)));
  15. }
  16. public string Username
  17. {
  18. get { return _username; }
  19. set { this.RaiseAndSetIfChanged(ref _username, value); }
  20. }
  21. public ReactiveCommand<object> OkCommand
  22. {
  23. get;
  24. private set;
  25. }
  26. }
  27. }