private DataCommand ( object dataItem, |
||
dataItem | object | |
commandMethod | ||
return | System |
private DataCommand(object dataItem, MethodInfo commandMethod)
{
_dataItem = dataItem;
_commandMethod = commandMethod;
INotifyPropertyChanged propChangeNotifier = dataItem as INotifyPropertyChanged;
if (propChangeNotifier != null) {
_canExecuteProperty =
_dataItem.GetType().GetProperty("Can" + _commandMethod.Name,
BindingFlags.FlattenHierarchy |
BindingFlags.Instance | BindingFlags.Public);
if (_canExecuteProperty != null) {
propChangeNotifier.PropertyChanged += OnDataItemPropertyChanged;
}
}
}