Hi,
I am trying to create a context menu in my application. The context
menu takes menu otems from an XML file. In XAML the code is
<Grid.ContextMe nu>
<ContextMenu Name="cm" StaysOpen="true " Width="Auto"
Height="Auto" ItemsSource="{B inding Mode=OneWay,
Source={StaticR esource ListItemsDS}, XPath=/ListboxItems/ListboxItem/
ScreenName}" MenuItem.Click= "add_Click" >
</ContextMenu>
</Grid.ContextMen u>
The c# code for the even is
private void add_Click(objec t sender, RoutedEventArgs e)
{
MessageBox.Show ("CLICKED " );
}
I am unable to get the value of the clicked item.
Any idea what I am doing wrong?
Thanks for your help in advance!
I am trying to create a context menu in my application. The context
menu takes menu otems from an XML file. In XAML the code is
<Grid.ContextMe nu>
<ContextMenu Name="cm" StaysOpen="true " Width="Auto"
Height="Auto" ItemsSource="{B inding Mode=OneWay,
Source={StaticR esource ListItemsDS}, XPath=/ListboxItems/ListboxItem/
ScreenName}" MenuItem.Click= "add_Click" >
</ContextMenu>
</Grid.ContextMen u>
The c# code for the even is
private void add_Click(objec t sender, RoutedEventArgs e)
{
MessageBox.Show ("CLICKED " );
}
I am unable to get the value of the clicked item.
Any idea what I am doing wrong?
Thanks for your help in advance!
Comment