Disabling ContextMenu items dynamically

1 posts, 0 answers
  1. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 30 Nov 2012 Link to this post


    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:RadContextMenu x:Name="cMnuErrorMenu" ItemClick="rcmErrorMenu_ItemClick" 
                Opened="cMnuErrorMenu_Opened" ItemsSource="{Binding Employees}" 
                ItemTemplate="{StaticResource MenuItemTemplate}" 
                            Height="{Binding Res_Paths_ContextMenu_Height}" Width="380">                        

    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!!!

Back to Top