1
0

ExceptionErrorViewModel.cs 763 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) The Avalonia 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. using System;
  5. namespace BindingDemo.ViewModels
  6. {
  7. public class ExceptionErrorViewModel : ReactiveObject
  8. {
  9. private int _lessThan10;
  10. public int LessThan10
  11. {
  12. get { return _lessThan10; }
  13. set
  14. {
  15. if (value < 10)
  16. {
  17. this.RaiseAndSetIfChanged(ref _lessThan10, value);
  18. }
  19. else
  20. {
  21. throw new ArgumentOutOfRangeException("Value must be less than 10.");
  22. }
  23. }
  24. }
  25. }
  26. }