问题
I'm trying to add event handler to a cell in DataTable by editing the cell style. Specifically, I'm setting
<EventSetter Event="TargetUpdated" Handler="TaskDescription_TextChanged1Event"/>
And here's the error that I'm getting:
System.Windows.FrameworkElement.TargetUpdated="TaskDescription_TextChanged1Event"
is not valid. 'TargetUpdated' must be a RoutedEvent registered with a name that
ends with the keyword "Event".
Here's the code for TaskDescription_TextChanged1Event:
public void TaskDescription_TextChanged1Event(object sender,
RoutedEventArgs e)
{
}
What should I do for this to work?
回答1:
You cannot use EventSetters
for events which are not routed, however according to the documentation FrameworkElement.TargetUpdated is an alias event for Binding.TargetUpdated, which is routed, so subscribing to that might work out.
来源:https://stackoverflow.com/questions/10132362/system-windows-frameworkelement-targetupdated-is-not-valid-targetupdated