我有一个 Human 类,需要获取“IsChecked”值。ItemsSource 可能有不同的类型,但所有类都有 IsChecked 属性。
public class Human{
public bool IsChecked{
get;
set;
}
}
private void CheckBoxLoaded(object sender, RoutedEventArgs e) //sender is CheckBox
//How set value from IsChecked?
var prop = t.GetType().GetProperties().Single(n => n.Name == "IsChecked");//I can access it by this method, but can't set value of sender which CheckBox;
}