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

Disabling ContextMenu items dynamically

0 Answers 62 Views
Menu
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 30 Nov 2012, 11:47 AM
Hi,

We are using Telerik Controls for Silverlight.
We need to disable some of  the Context menu items based on some property value.

I see some sample where we can loop through the RadMenuItems and can set the IsEnable property.

But in our case we are using "HierarchicalDataTemplate" to load data dynamically using MVVM.
Following is the code.
<telerik:HierarchicalDataTemplate x:Key="MenuItemTemplate"
                                  ItemsSource="{Binding Employees}">
  
    <TextBlock Text="{Binding Name}" />
</telerik:HierarchicalDataTemplate>

<telerik:RadContextMenu.ContextMenu>
    <telerik:RadContextMenu x:Name="cMnuErrorMenu" ItemClick="rcmErrorMenu_ItemClick" 
            Opened="cMnuErrorMenu_Opened" ItemsSource="{Binding Employees}" 
            ItemTemplate="{StaticResource MenuItemTemplate}" 
                        Height="{Binding Res_Paths_ContextMenu_Height}" Width="380">                        
    </telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>

I am trying to handle this in the ContextMenu opened event, but there I am not able to find "RadMenuItem" from the collection.

Please help!!!

Regards,
SivaPrasad.B

No answers yet. Maybe you can help?

Tags
Menu
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or