【发布时间】:2014-01-23 12:39:01
【问题描述】:
我在 silverlight 数据网格中的复选框的选中和未选中事件上应用了一个函数。我已经在 xaml.cs 部分中创建了该函数。如何在 ViewModel 中实现相同的功能?
主要问题是我需要在 ViewModel 中访问发件人。
private void HandleChecked(object sender, RoutedEventArgs e)
{
CheckBox chk = sender as CheckBox;
var bindingExpression = chk.GetBindingExpression(CheckBox.IsCheckedProperty);
if (bindingExpression != null)
{
bindingExpression.UpdateSource();
}
}
【问题讨论】:
标签: c# silverlight mvvm checkbox viewmodel