This is a migrated thread and some comments may be shown as answers.

2 Context Menu Icon Issues

1 Answer 43 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Richard asked on 18 Sep 2011, 01:47 PM
I'm having two isses with the Context Menu at the moment that I hope you can help with.. 

Scenario 1
A GridView with Context Menu. The Context menu has 5 items each with an ItemTemplate that is a HierarchicalDataTemplate, bound to a ViewModel and populated via a web service. 
 
With Icons on the top level context menu items. 
If I right click immediately after the grid as loaded I consistently get a System.Windows.Markup.XamlParseException.  If I wait a second or two after the grid has loaded I do not get this error. 
 
Without Icons on the top level context menu items.
If I right click immediately after the grid as loaded it works every time.
 

<telerik:RadMenuItem Header="Add To Blueprint"
    ItemsSource="{Binding BlueprintContextMenuItems}"
    ItemTemplate="{StaticResource BlueprintContextMenuTemplate}" >
     
    <telerik:RadMenuItem.Icon>
        <Image Source="/TestApp;component/Assets/Icons/Blueprint/Blueprint_32x32.png" />
    </telerik:RadMenuItem.Icon>
</telerik:RadMenuItem>

 
Scenario 2
I have a RadMenu consisting of RadMenuItems, these items are built from a HierarchicalDataTemplate. I have a context meun on some of these items with icons. The icons do not show up when the Context Menu is displayed. However, if I create a “dummy” copy of the image in xmal at the bottom of the page , ie.  <Image Source="….Img.png"  Visibility="Collapsed"/> the icons in the context menu are displayed. As if this referace to the image makes it available to the menu where as it’s own RadMenuItem.Icon does not. 
 
Can I also just say I love these controls and the HierarchicalDataTemplate is just wonderful. :)

Thanks,
Richard

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 23 Sep 2011, 07:50 AM
Hello Richard,

RadMenu/RadContextMenu indeed have this limitation which prevents their items from updating its template correctly once they are loaded. I am not sure if this is fixable at all, but should be relatively easy to workaround - you just need to set ItemsSource on the ContextMenu after it is entirely populated. I suppose this limitation is causing also the wrong loading of the Icons.

Could you please try this approach and let us know if that fixed the issue.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Menu
Asked by
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Konstantina
Telerik team
Share this question
or