0
我有一個函數應用於silverlight數據網格中複選框的check和unchecked事件。我在xaml.cs中創建了這個函數。我如何在ViewModel中做同樣的功能?在ViewModel中處理CheckBox的Checked和Uncheck事件Silverlight MVVM
主要問題是我需要在ViewModel中訪問發件人。
private void HandleChecked(object sender, RoutedEventArgs e)
{
CheckBox chk = sender as CheckBox;
var bindingExpression = chk.GetBindingExpression(CheckBox.IsCheckedProperty);
if (bindingExpression != null)
{
bindingExpression.UpdateSource();
}
}