Is there a way to fire an event from a visual within a DataTemplate in the current context (i.e. Page, Window, UserControl etc.).
有没有办法在当前上下文中的DataTemplate中触发视觉事件(即Page,Window,UserControl等)。
For example I have a DataTemplate that contains a button or a ListBox. I want that when the button is clicked or when ListBox.SelectionChanged is fired in the ListBox, the event handler should be declared on the Page that contains the ControlControl which uses this DataTemplate.
例如,我有一个包含按钮或ListBox的DataTemplate。我希望在单击按钮或在ListBox中触发ListBox.SelectionChanged时,应在包含使用此DataTemplate的ControlControl的页面上声明事件处理程序。
Any ideas?
有任何想法吗?