I have a custom Attached Property but the Accessors on never being accessed on databinding. Are theses accessors meant to be accessed everytime the attached property changes?
public static readonly DependencyProperty CharacterColumnNumberProperty =
DependencyProperty.RegisterAttached("CharacterColumnNumber", typeof(int), typeof(DragCanvas), new UIPropertyMetadata(1));
public static int GetCharacterColumnNumber(UIElement uiElement)
{
if (uiElement != null)
return (int)uiElement.GetValue(CharacterColumnNumberProperty);
else return 0;
}
public static void SetCharacterColumnNumber(UIElement uiElement, int value)
{
if (uiElement != null)
{
uiElement.SetValue(CharacterColumnNumberProperty, value);
DragCanvas.SetLeft(uiElement, value * 10);
}
}
XAML:
<Setter Property="local:DragCanvas.CharacterColumnNumber" Value="{Binding Path=CharacterColumnNumber, Mode=TwoWay}" />