| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using Avalonia.Data;
- namespace Avalonia
- {
- /// <summary>
- /// Provides information for a avalonia property change.
- /// </summary>
- public abstract class AvaloniaPropertyChangedEventArgs : EventArgs
- {
- public AvaloniaPropertyChangedEventArgs(
- IAvaloniaObject sender,
- BindingPriority priority)
- {
- Sender = sender;
- Priority = priority;
- IsEffectiveValueChange = true;
- }
- internal AvaloniaPropertyChangedEventArgs(
- IAvaloniaObject sender,
- BindingPriority priority,
- bool isEffectiveValueChange)
- {
- Sender = sender;
- Priority = priority;
- IsEffectiveValueChange = isEffectiveValueChange;
- }
- /// <summary>
- /// Gets the <see cref="AvaloniaObject"/> that the property changed on.
- /// </summary>
- /// <value>The sender object.</value>
- public IAvaloniaObject Sender { get; }
- /// <summary>
- /// Gets the property that changed.
- /// </summary>
- /// <value>
- /// The property that changed.
- /// </value>
- public AvaloniaProperty Property => GetProperty();
- /// <summary>
- /// Gets the old value of the property.
- /// </summary>
- public object? OldValue => GetOldValue();
- /// <summary>
- /// Gets the new value of the property.
- /// </summary>
- public object? NewValue => GetNewValue();
- /// <summary>
- /// Gets the priority of the binding that produced the value.
- /// </summary>
- /// <value>
- /// The priority of the new value.
- /// </value>
- public BindingPriority Priority { get; private set; }
- internal bool IsEffectiveValueChange { get; private set; }
- protected abstract AvaloniaProperty GetProperty();
- protected abstract object? GetOldValue();
- protected abstract object? GetNewValue();
- }
- }
|