System.Windows.FrameworkElement.TargetUpdated=“…” is not valid. 'TargetUpdated' must be a RoutedEvent

烂漫一生 提交于 2021-01-28 07:53:32

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!