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

RadMenuItem Click event not working using Event Triggers

1 Answer 191 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vidyadhar
Top achievements
Rank 1
Vidyadhar asked on 20 Mar 2012, 10:17 PM
Hi,

Am trying to fire the Click Event on the RadMenuItem using Expression Blend's Event Triggers, but couldn't get it triggered. The trigger fires for the buttons, Checkboxes, etc... but not for the RadMenuItem_Click. I recently upgraded my application to Silverlight 5 and the latest Telerik Controls (Silverlight 5 Q1 2012).

 <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu NotifyOnHeaderClick="True">
                        <telerik:RadMenuItem Name="TreeNode_MenuItem_1" Header="Map Zoom" >
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <ei:CallMethodAction TargetObject="{Binding}" MethodName="onContextMenuClick" />     
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </telerik:RadMenuItem>                        
                        <telerik:RadMenuItem Name="TreeNode_MenuItem_2" Header="View Detail Data"/>
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>


And here's my ViewModel method.

    public void onContextMenuClick(object sender, RoutedEventArgs e)
        {
            //get the telerik context menu item
            RadMenuItem menuItem = e.OriginalSource as RadMenuItem;           
        }

I did try using RadRoutedEventArgs instead of RoutedEventArgs, and also the EventArgs, but none helped.


Can you help me out with this.
Thanks,
Vidyadhar.

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 26 Mar 2012, 12:21 PM
Hi Vidyadhar,

I tested your code and it seems to work as expected - the method is called once the menu item is clicked. Please make sure that you have set properly the DataContext and that it has reached correctly to the RadContextMenu.
For your reference I am sending you a short video which illustrates my attempt.

Greetings,
Konstantina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Menu
Asked by
Vidyadhar
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or