I have setted a property like this:
public static readonly DependencyProperty ValorRegistadoProperty = DependencyProperty.RegisterAttached(
"ValorRegistado",
typeof(string),
typeof(CampoInfo), new PropertyMetadata(new PropertyChangedCallback((d, e) =>
{
System.Diagnostics.Debug.WriteLine("Valor mudado");
})));
public static void SetValorRegistado(UIElement element, string value)
{
if (string.IsNullOrEmpty(value.Trim()))
throw new Exception("Por favor preencha este valor.");
element.SetValue(ValorRegistadoProperty, value);
}
public static string GetValorRegistado(UIElement element)
{
return (string)element.GetValue(ValorRegistadoProperty);
}
And have the control declared like this:
<toolkit:NumericUpDown Value="{Binding (CampoInfo.ValorRegistado), Mode=TwoWay}">
I know I heve to user a converter, but this doens't give me any error anyway....
How do you bind custom dependency properties?