IObservablePropertyBag.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 
  2. namespace Perspex
  3. {
  4. using System;
  5. /// <summary>
  6. /// Interface for getting/setting <see cref="PerspexProperty"/> bindings on an object.
  7. /// </summary>
  8. public interface IObservablePropertyBag : IPropertyBag
  9. {
  10. /// <summary>
  11. /// Binds a <see cref="PerspexProperty"/> to an observable.
  12. /// </summary>
  13. /// <param name="property">The property.</param>
  14. /// <param name="source">The observable.</param>
  15. /// <param name="priority">The priority of the binding.</param>
  16. /// <returns>
  17. /// A disposable which can be used to terminate the binding.
  18. /// </returns>
  19. IDisposable Bind(
  20. PerspexProperty property,
  21. IObservable<object> source,
  22. BindingPriority priority = BindingPriority.LocalValue);
  23. /// <summary>
  24. /// Binds a <see cref="PerspexProperty"/> to an observable.
  25. /// </summary>
  26. /// <typeparam name="T">The type of the property.</typeparam>
  27. /// <param name="property">The property.</param>
  28. /// <param name="source">The observable.</param>
  29. /// <param name="priority">The priority of the binding.</param>
  30. /// <returns>
  31. /// A disposable which can be used to terminate the binding.
  32. /// </returns>
  33. IDisposable Bind<T>(
  34. PerspexProperty<T> property,
  35. IObservable<T> source,
  36. BindingPriority priority = BindingPriority.LocalValue);
  37. /// <summary>
  38. /// Gets an observable for a <see cref="PerspexProperty"/>.
  39. /// </summary>
  40. /// <param name="property">The property.</param>
  41. /// <returns>An observable.</returns>
  42. IObservable<object> GetObservable(PerspexProperty property);
  43. /// <summary>
  44. /// Gets an observable for a <see cref="PerspexProperty"/>.
  45. /// </summary>
  46. /// <typeparam name="T">The type of the property.</typeparam>
  47. /// <param name="property">The property.</param>
  48. /// <returns>An observable.</returns>
  49. IObservable<T> GetObservable<T>(PerspexProperty<T> property);
  50. }
  51. }