PropertyError.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. namespace Avalonia.Data.Core.Plugins
  3. {
  4. /// <summary>
  5. /// An <see cref="IPropertyAccessor"/> that represents an error.
  6. /// </summary>
  7. public class PropertyError : IPropertyAccessor
  8. {
  9. private BindingNotification _error;
  10. /// <summary>
  11. /// Initializes a new instance of the <see cref="PropertyError"/> class.
  12. /// </summary>
  13. /// <param name="error">The error to report.</param>
  14. public PropertyError(BindingNotification error)
  15. {
  16. _error = error;
  17. }
  18. /// <inheritdoc/>
  19. public Type PropertyType => null;
  20. /// <inheritdoc/>
  21. public object Value => _error;
  22. /// <inheritdoc/>
  23. public void Dispose()
  24. {
  25. }
  26. /// <inheritdoc/>
  27. public bool SetValue(object value, BindingPriority priority)
  28. {
  29. return false;
  30. }
  31. public void Subscribe(Action<object> listener)
  32. {
  33. listener(_error);
  34. }
  35. public void Unsubscribe()
  36. {
  37. }
  38. }
  39. }