我有一个带有复选框的数据网格和一个连续的文本框。当值为文本框被修改并按下回车时,应根据值是否被修改来检查复选框。请告诉我我该怎么做?我没有文件后面的代码。
问问题
461 次
1 回答
0
<DataGrid...ItemsSource={Binding ViewModel.YourRowItems
...some column
<TextBox Text="{Binding SomeText}"...
....some column
<CheckBox IsChecked="{Binding IsChecked="{Binding IsSomeProp}"..
在 ViewModel 中,当 SomeText 属性改变时,翻转/更新 IsSomeProp,它会通过绑定更新 IsChecked
public string SomeText
{
get {return _someText;}
set
{
if (_someText != value ..
{
_someText = value;
if(value != _originalSomeText)
IsSomeProp = true;//this of course will raise prop changed for IsSomeProp
RaisePropertyChanged( ()=> SomeText);
}
}
...无论如何,这就是要点
于 2012-05-03T18:47:32.310 回答