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

MenuItem and updating IsChecked

1 Answer 220 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Michele asked on 11 May 2012, 11:13 AM
I'm using RadMenu in an MVVM Caliburn Micro application,I've also a RadDocking that contains my views ... some views are sistem views and they should be enabled/disabled by a menu called Views...I've got difficulties since if I just use the menu (check/unchek) for showing/hiding it work fine, but if I start closing from the "X" I got the IsChecked desinked with the real view state.... since I use this this piece of code for the RadMenu, where do I specify the SubmenuOpened event? If I'm able to access it I can calculate the state of the views...

        <BooleanToVisibilityConverter x:Key="booleanConverter" />
        <selectors:MenuItemTemplateSelector x:Key="templateSelector"></selectors:MenuItemTemplateSelector>
        <HierarchicalDataTemplate x:Key="MenuItemTemplate" ItemsSource="{Binding Items}">
            <TextBlock Text="{Binding Text}" cal:Action.TargetWithoutContext="{Binding}"
                 Visibility="{Binding IsVisible,Mode=TwoWay,Converter={StaticResource booleanConverter}}" />
        <telerik:RadMenu  x:Name="MenuList" ClickToOpen="False"  BorderBrush="Transparent" ItemsSource="{Binding Items}" ItemTemplate="{StaticResource MenuItemTemplate}"  
                     cal:Message.Attach="[Event ItemClick] = [Action OpenView($eventArgs)]"  >
                <Style TargetType="telerik:RadMenuItem">
                    <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
                    <Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
                    <Setter Property="IsCheckable" Value="{Binding IsCheckable}" />
                    <Setter Property="StaysOpenOnClick" Value="{Binding IsCheckable}" />


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 15 May 2012, 08:18 AM
Hi Paolo,

SubmenuOpened event is a RoutedEvent so could handle it using the AddHandler method. But if you are using ViewModel with two way Binding will be much easier.

Here is a sample code that shows how to handle SubmenuOpened routed event:
void MainWindow()
            this.AddHandler(RadMenuItem.SubmenuOpenedEvent, new Telerik.Windows.RadRoutedEventHandler(OnSubmenuOpened));
        void OnSubmenuOpened(object sender, Telerik.Windows.RadRoutedEventArgs e)
            RadMenuItem source = e.OriginalSource as RadMenuItem;
            // do something with the MenuItem or its children.

the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question