-2
我有一个绑定到属性的TextBox。有没有办法更新文本框的内容,而不使用更新TextBox的内容
RaisePropertyChanged(() => Property);
里面的属性?
我想更新另一个Property2中Property1的值,然后更新绑定到Property2内Property1的TextBox的值。
这可能吗?
我有一个绑定到属性的TextBox。有没有办法更新文本框的内容,而不使用更新TextBox的内容
RaisePropertyChanged(() => Property);
里面的属性?
我想更新另一个Property2中Property1的值,然后更新绑定到Property2内Property1的TextBox的值。
这可能吗?
我相信你可能正在寻找一个PropertyChangedCallback。
基本sentax是这样的:
static ClassName()
{
Property = DependencyProperty.Register("PropertyName", typeof(propertyType), typeof(ownerType),
new UIPropertyMetadata(new PropertyChangedCallback(PropertyChangedCallback));
}
static void PropertyChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArts e)
{
ClassName class = obj as ClassName;
// Manipulate properties by accessing them through class.
}
请参阅此链接了解更多信息: http://msdn.microsoft.com/en-us/library/ms745795.aspx
为什么你不这样做呢? – 2012-07-11 21:38:18