| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- // Copyright (c) The Avalonia Project. All rights reserved.
- // Licensed under the MIT license. See licence.md file in the project root for full license information.
- using System;
- using Avalonia.Data;
- namespace Avalonia
- {
- /// <summary>
- /// Interface for getting/setting <see cref="AvaloniaProperty"/> values on an object.
- /// </summary>
- public interface IAvaloniaObject
- {
- /// <summary>
- /// Raised when a <see cref="AvaloniaProperty"/> value changes on this object.
- /// </summary>
- event EventHandler<AvaloniaPropertyChangedEventArgs> PropertyChanged;
- /// <summary>
- /// Raised when an inheritable <see cref="AvaloniaProperty"/> value changes on this object.
- /// </summary>
- event EventHandler<AvaloniaPropertyChangedEventArgs> InheritablePropertyChanged;
- /// <summary>
- /// Gets a <see cref="AvaloniaProperty"/> value.
- /// </summary>
- /// <param name="property">The property.</param>
- /// <returns>The value.</returns>
- object GetValue(AvaloniaProperty property);
- /// <summary>
- /// Gets a <see cref="AvaloniaProperty"/> value.
- /// </summary>
- /// <typeparam name="T">The type of the property.</typeparam>
- /// <param name="property">The property.</param>
- /// <returns>The value.</returns>
- T GetValue<T>(AvaloniaProperty<T> property);
- /// <summary>
- /// Checks whether a <see cref="AvaloniaProperty"/> is animating.
- /// </summary>
- /// <param name="property">The property.</param>
- /// <returns>True if the property is animating, otherwise false.</returns>
- bool IsAnimating(AvaloniaProperty property);
- /// <summary>
- /// Checks whether a <see cref="AvaloniaProperty"/> is set on this object.
- /// </summary>
- /// <param name="property">The property.</param>
- /// <returns>True if the property is set, otherwise false.</returns>
- bool IsSet(AvaloniaProperty property);
- /// <summary>
- /// Sets a <see cref="AvaloniaProperty"/> value.
- /// </summary>
- /// <param name="property">The property.</param>
- /// <param name="value">The value.</param>
- /// <param name="priority">The priority of the value.</param>
- void SetValue(
- AvaloniaProperty property,
- object value,
- BindingPriority priority = BindingPriority.LocalValue);
- /// <summary>
- /// Sets a <see cref="AvaloniaProperty"/> value.
- /// </summary>
- /// <typeparam name="T">The type of the property.</typeparam>
- /// <param name="property">The property.</param>
- /// <param name="value">The value.</param>
- /// <param name="priority">The priority of the value.</param>
- void SetValue<T>(
- AvaloniaProperty<T> property,
- T value,
- BindingPriority priority = BindingPriority.LocalValue);
- /// <summary>
- /// Binds a <see cref="AvaloniaProperty"/> to an observable.
- /// </summary>
- /// <param name="property">The property.</param>
- /// <param name="source">The observable.</param>
- /// <param name="priority">The priority of the binding.</param>
- /// <returns>
- /// A disposable which can be used to terminate the binding.
- /// </returns>
- IDisposable Bind(
- AvaloniaProperty property,
- IObservable<object> source,
- BindingPriority priority = BindingPriority.LocalValue);
- /// <summary>
- /// Binds a <see cref="AvaloniaProperty"/> to an observable.
- /// </summary>
- /// <typeparam name="T">The type of the property.</typeparam>
- /// <param name="property">The property.</param>
- /// <param name="source">The observable.</param>
- /// <param name="priority">The priority of the binding.</param>
- /// <returns>
- /// A disposable which can be used to terminate the binding.
- /// </returns>
- IDisposable Bind<T>(
- AvaloniaProperty<T> property,
- IObservable<T> source,
- BindingPriority priority = BindingPriority.LocalValue);
- }
- }
|