using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using FWindSoft.Wpf.History; namespace FWindSoft.Wpf.Controls { public class HistoryControl { public static readonly DependencyProperty IsSaveProperty = DependencyProperty.RegisterAttached("IsSave", typeof(bool), typeof(HistoryControl), new PropertyMetadata(false, OnPropertyChanged)); public static readonly DependencyProperty ValueAdapterProperty = DependencyProperty.RegisterAttached("ValueAdapter", typeof(ElementValueProvider), typeof(HistoryControl), new PropertyMetadata(null, OnPropertyChanged)); public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //TextBox textBox = d as TextBox; //if (textBox == null) // return; } [AttachedPropertyBrowsableForType(typeof(Control))] public static ElementValueProvider GetValueAdapter(DependencyObject obj) { return obj.GetValue(ValueAdapterProperty) as ElementValueProvider; } [AttachedPropertyBrowsableForType(typeof(Control))] public static void SetValueAdapter(DependencyObject obj, string value) { obj.SetValue(ValueAdapterProperty, value); } [AttachedPropertyBrowsableForType(typeof(Control))] public static bool GetIsSave(DependencyObject obj) { return (bool)obj.GetValue(IsSaveProperty); } [AttachedPropertyBrowsableForType(typeof(Control))] public static void SetIsSave(DependencyObject obj, bool value) { obj.SetValue(IsSaveProperty, value); } } }