using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
namespace Server_Dashboard {
///
/// Attached property base class
///
///
///
public abstract class BaseAttachedProperty
where TParent : BaseAttachedProperty, new() {
public event Action ValueChanged = (sender, e) => { };
public static TParent Instance { get; private set; } = new TParent();
public static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached("Value", typeof(TProperty), typeof(BaseAttachedProperty), new PropertyMetadata(new PropertyChangedCallback(OnValuePropertyChanged)));
private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
Instance.OnValueChanged(d, e);
Instance.ValueChanged(d, e);
}
public static TProperty GetValue(DependencyObject d) => (TProperty)d.GetValue(ValueProperty);
public static void SetValue(DependencyObject d, TProperty value) => d.SetValue(ValueProperty, value);
public virtual void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) {
}
}
}