Say I have the following dependency property:
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(
"IsActive",
typeof(bool),
typeof(MyAttachedProp),
new PropertyMetadata(false));
What is the difference between the following property accessor patterns:
public static void SetIsActive(DependencyObject obj, bool value)
{
obj.SetValue(IsActiveProperty, value);
}
public static bool GetIsActive(DependencyObject obj)
{
return (bool)obj.GetValue(IsActiveProperty);
}
vs
public bool IsActive
{
get
{
return (bool)GetValue(IsActiveProperty);
}
set
{
SetValue(IsActiveProperty, value);
}
}
I'm assuming which one you use depends on what you are authoring, e.g. an attached property/behaviour, converter, control, etc?