routedeventargs

Why is the TextBlock not the OriginalSource on the Routed Event?

帅比萌擦擦* 提交于 2019-12-31 03:05:12
问题 I'm showing a context menu for elements in a ListView . The context menu is attached to the TextBlock s of the ListView as follows. <ListView.Resources> <ContextMenu x:Key="ItemContextMenu"> <MenuItem Command="local:MyCommands.Test" /> </ContextMenu> <Style TargetType="{x:Type TextBlock}" > <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}" /> </Style> </ListView.Resources> The context menu properly shows up and the RoutedUIEvent is fired as well. The issue is that in the

Why is the TextBlock not the OriginalSource on the Routed Event?

纵饮孤独 提交于 2019-12-02 02:29:23
I'm showing a context menu for elements in a ListView . The context menu is attached to the TextBlock s of the ListView as follows. <ListView.Resources> <ContextMenu x:Key="ItemContextMenu"> <MenuItem Command="local:MyCommands.Test" /> </ContextMenu> <Style TargetType="{x:Type TextBlock}" > <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}" /> </Style> </ListView.Resources> The context menu properly shows up and the RoutedUIEvent is fired as well. The issue is that in the Executed callback the ExecutedRoutedEventArgs.OriginalSource is a ListViewItem and not the TextBlock.

Passing variable with RoutedEventArgs?

别来无恙 提交于 2019-11-27 18:07:09
问题 I have the following class, and want to pass the text variable as RoutedEventArgs. public class CloseableTabItem : TabItem { String text; public CloseableTabItem() { //This style is defined in themes\generic.xaml DefaultStyleKeyProperty.OverrideMetadata(typeof(CloseableTabItem), new FrameworkPropertyMetadata(typeof(CloseableTabItem))); } public CloseableTabItem(String incomingText) { //This style is defined in themes\generic.xaml DefaultStyleKeyProperty.OverrideMetadata(typeof