【发布时间】:2015-07-06 05:50:47
【问题描述】:
我的 ViewModel 上有一个属性,我需要在我的行为中绑定到 BindableProperty,但我似乎无法绑定它。
private int _test;
public int Test {
get {
return _test;
}
set {
if (SetProperty (ref _test, value)) {
_profileIsDirty = true;
NotifyPropertyChanged ("AllowUpdate");
}
}
}
这是行为中的属性
public static readonly BindableProperty MinLengthProperty = BindableProperty.Create("MinLength", typeof(int), typeof(MinLengthValidator), 0);
public int MinLength
{
get { return (int)GetValue(MinLengthProperty); }
set { SetValue(MinLengthProperty, value); }
}
这是 ViewModel 上的属性,这就是我尝试在 XAML 中绑定它的方式
<behave:TelephoneNumberValidatorBehaviour x:Name="phoneValidator" MinLength="{Binding Test, Mode=OneWay}"/>
但它永远不会绑定。我在这里做错了吗?
【问题讨论】:
标签: c# xaml mvvm xamarin xamarin.forms