Hi Georgi ,
I specified my previous and present code. We used CustomMenuItem that you suggested; but used only 'OnKeyDown', and not OnKeyUp
When we assign the MenuItems list to the CustomMenuItem control through ItemsSource property , menu items of type ‘RadMenuItem’ are getting generated instead of ‘CustomMenuItem’; and not able to invoke any of the 'CustomMenuItem' events. If i do, or add the menuitems as specified in the Modified Code portion; then we are able to handle 'CustomMenuItem' events, like keyup or etc..
Previous code:
<customTelerikMenu:CustomMenuItem x:Name="radWidgetMenuItem" Style="{StaticResource RadMenuItemStyle1}" ItemsSource="{Binding MenuItems}"
Cursor="Hand" ItemTemplate="{StaticResource WidgetMenuItemTemplate}">
<customTelerikMenu:CustomMenuItem.Icon>
<Path … … />
</customTelerikMenu:CustomMenuItem.Icon>
</customTelerikMenu:CustomMenuItem>
Modified code:
StringBuilder sb = new StringBuilder();
sb.Append("<telerik:RadMenu … ");
sb.Append("<customTelerikMenu:IntuitionMenuItem>");
foreach (MenuItem item in MenuViewModel.MenuItems)
{
sb.Append("<customTelerikMenu:IntuitionMenuItem Header=\"" + item.Text + "\" />");
}
sb.Append("</customTelerikMenu:IntuitionMenuItem>");
sb.Append("</telerik:RadMenu>");
RadMenu radMenu = (RadMenu)(System.Windows.Markup.XamlReader.Load(sb.ToString()));
expanderPanel.expanderMenu.LayoutRoot.Children.Add(radMenu);
I believe that, this is not appropriate way. Do you have any suggestion/approach to handle this?
Regards,
Ashok