Hi,
This may sound like a dumb question, but I can't find it in the documentation or the demos... I have a context menu which displays on the MouseLeftButtonDown event of the main layout grid for a usercontrol, which displays fine. The question is, how do I handle a selection from the context menu? If I try to add an event handler (Click, MouseLeftButtonUp, etc.), I get XamlReader.Load() does not accept event handlers [Line 297, Position 70]. Here is a simplified version of the code I'm using, basically I use this usercontrol as a container to load other items, but the entire container needs to respond to the mouse event for the context menu:
This may sound like a dumb question, but I can't find it in the documentation or the demos... I have a context menu which displays on the MouseLeftButtonDown event of the main layout grid for a usercontrol, which displays fine. The question is, how do I handle a selection from the context menu? If I try to add an event handler (Click, MouseLeftButtonUp, etc.), I get XamlReader.Load() does not accept event handlers [Line 297, Position 70]. Here is a simplified version of the code I'm using, basically I use this usercontrol as a container to load other items, but the entire container needs to respond to the mouse event for the context menu:
<UserControl xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" x:Class="Silverlight_Portfolio.GalleryItem" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Width="150" Height="150"> |
<Grid x:Name="LayoutRoot" Background="Transparent" ShowGridLines="False"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="10" /> |
<ColumnDefinition Width="130" /> |
<ColumnDefinition Width="10" /> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="10" /> |
<RowDefinition Height="110" /> |
<RowDefinition Height="30" /> |
</Grid.RowDefinitions> |
<telerikNavigation:RadContextMenu.ContextMenu> |
<telerikNavigation:RadContextMenu x:Name="RadContext" Placement="Absolute" EventName="MouseLeftButtonDown"> |
<telerikNavigation:RadMenuItem Header="View this picture" Tag="ViewThis" /> |
<telerikNavigation:RadMenuItem Header="More by this artist" Tag="MoreByArtist" /> |
<telerikNavigation:RadMenuItem Header="More from this genre" Tag="MoreByGenre" /> |
<telerikNavigation:RadMenuItem Header="Add To favorites" Tag="Favorite" /> |
</telerikNavigation:RadContextMenu> |
</telerikNavigation:RadContextMenu.ContextMenu> |
<Border x:Name="styleBorder" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="3" Margin="2 4 2 4"> |
</Border> |
</Grid> |
</UserControl> |
In a perfect world, when I select the second item, "More by this artist", it would grab a value stored in the Tag of the styleBorder and use that in the event handling the selection/click of the context menu item, pulling up more pictures by the artist. So... how would I go about doing handling this event to make this happen? :)
Thanks!!