When the context menu is used inside a datagrid cell, it stops working. Take a look at the following code, I've included some information in the xaml about the behaviour of the menu. Please make sure this is fixed as soon as possible, as it prevents us from demonstrating our app to clients.
Best regards,
/Henrik
Best regards,
/Henrik
<UserControl x:Class="TelerikTestProject.SilverlightControl5" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerikbase="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
xmlns:telerikinput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" |
xmlns:teleriknav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" |
xmlns:m="clr-namespace:System.Windows.Controls;assembly=System.Windows" |
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" |
Width="500" |
Height="400"> |
<UserControl.Resources> |
<DataTemplate x:Key="Template"> |
<TextBlock Text="Menu" |
Margin="10,3,10,3" |
VerticalAlignment="Center"> |
<teleriknav:RadContextMenu.ContextMenu> |
<teleriknav:RadContextMenu EventName="MouseLeftButtonDown" |
Placement="Bottom"> |
<teleriknav:RadContextMenu.Items> |
<teleriknav:RadMenuItem Header="Item 1"></teleriknav:RadMenuItem> |
<teleriknav:RadMenuItem Header="Item 2"></teleriknav:RadMenuItem> |
</teleriknav:RadContextMenu.Items> |
</teleriknav:RadContextMenu> |
</teleriknav:RadContextMenu.ContextMenu> |
</TextBlock> |
</DataTemplate> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" |
Background="White"> |
<StackPanel> |
<TextBlock HorizontalAlignment="Left" |
Margin="5" |
TextWrapping="Wrap" |
Width="350" |
Text="The behaviour of the context menu is erratic. Very often a click in the menu does not trigger an event as it should. |
Some observations:
 |
* The first of the three menus does not work when the page is loaded.
 |
* The first menu starts working if another cell is clicked and the menu is opened immediately.
 |
* None of the menus work for more than one click. As soon as a click is registered, the |
event chain dies. Only when another cell is focused do the menus start working again."></TextBlock> |
<TextBlock x:Name="Result" |
Margin="5" |
FontWeight="Bold" |
Foreground="Green"></TextBlock> |
<data:DataGrid x:Name="DataGrid1" |
AutoGenerateColumns="False" |
HorizontalAlignment="Stretch" |
VerticalAlignment="Stretch"> |
<data:DataGrid.Columns> |
<data:DataGridTemplateColumn CellTemplate="{StaticResource Template}"></data:DataGridTemplateColumn> |
<data:DataGridTextColumn Binding="{Binding}"></data:DataGridTextColumn> |
</data:DataGrid.Columns> |
</data:DataGrid> |
</StackPanel> |
</Grid> |
</UserControl> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Net; |
using System.Windows; |
using System.Windows.Controls; |
using System.Windows.Documents; |
using System.Windows.Input; |
using System.Windows.Media; |
using System.Windows.Media.Animation; |
using System.Windows.Shapes; |
using Telerik.Windows; |
using Telerik.Windows.Controls; |
namespace TelerikTestProject |
{ |
public partial class SilverlightControl5 : UserControl |
{ |
private int _ClickCount = 0; |
public SilverlightControl5() |
{ |
InitializeComponent(); |
this.RemoveHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(RadMenu_ItemClick)); |
this.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(RadMenu_ItemClick), true); |
DataGrid1.ItemsSource = new List<string>() { "First row", "Second row", "Third row" }; |
Result.Text = String.Format("{0} clicks made.", _ClickCount.ToString()); |
} |
public void RadMenu_ItemClick(object sender, RoutedEventArgs e) |
{ |
_ClickCount++; |
Result.Text = String.Format("{0} clicks made.", _ClickCount.ToString()); |
} |
} |
} |