PropertyMetadata (Dr. WPF snippets !).
#region IsAvailable
private static bool DefaultIsAvailable = false;
public static readonly DependencyProperty IsAvailableProperty =
DependencyProperty.Register(
"IsAvailable",
typeof(bool),
typeof(CustomControl1),
new PropertyMetadata(DefaultIsAvailable, OnIsAvailableChanged));
public bool IsAvailable
{
get { return (bool)GetValue(IsAvailableProperty); }
set { SetValue(IsAvailableProperty, value); }
}
private static void OnIsAvailableChanged(
DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var target = (CustomControl1)d;
bool oldIsAvailable = (bool)e.OldValue;
bool newIsAvailable = target.IsAvailable;
target.OnIsAvailableChanged(oldIsAvailable, newIsAvailable);
}
protected virtual void OnIsAvailableChanged(
bool oldIsAvailable, bool newIsAvailable)
{
}
#endregion
*
- , , OneWay - ie - - .
Mode="TwoWay" - , ( ) , .