This question is locked. New answers and comments are not allowed.
Hi,
I want to use context menus in my grid, but I might be doing something wrong because I only get the Silverlight configuration option when I right click on the grid.
I followed the website example attaching one context menu per row, but the event "OnMenuOpen" never gets triggered
Thanks much for your help,
Marco
I want to use context menus in my grid, but I might be doing something wrong because I only get the Silverlight configuration option when I right click on the grid.
I followed the website example attaching one context menu per row, but the event "OnMenuOpen" never gets triggered
| private void SamplesGrid_RowLoaded(object sender, RowLoadedEventArgs e) |
| { |
| if (!(e.Row is GridViewHeaderRow) && !(e.Row is GridViewNewRow)) |
| { |
| var rowContextMenu = new RadContextMenu(); |
| StyleManager.SetTheme(rowContextMenu, StyleManager.GetTheme(SamplesGrid)); |
| rowContextMenu.Items.Add(new RadMenuItem { Header = "Add Row" }); |
| rowContextMenu.Items.Add(new RadMenuItem { Header = "Delete Selected Row(s)" }); |
| rowContextMenu.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClick)); |
| rowContextMenu.Opened += OnMenuOpened; |
| RadContextMenu.SetContextMenu(e.Row, rowContextMenu); |
| MessageBox.Show("SamplesGrid_RowLoaded"); |
| } |
| } |
| private static void OnMenuOpened(object sender, RoutedEventArgs e) |
| { |
| MessageBox.Show("OnMenuOpened"); |
| var row = ((RadRoutedEventArgs)e).OriginalSource as GridViewRow; |
| if (row != null) |
| row.IsSelected = row.IsCurrent = ((GridViewCell)row.Cells[0]).IsCurrent = true; |
| } |
Thanks much for your help,
Marco
