一个值我已经设置好的属性是这样的:绑定的自定义扶养属性的Silverlight
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);
}
而且具有控制声明如下:
<toolkit:NumericUpDown Value="{Binding (CampoInfo.ValorRegistado), Mode=TwoWay}">
我知道我HEVE用户转换器,但这不会给我任何错误......无论如何...
你如何绑定自定义依赖属性?