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

Add Menu Item to RadPane's menu

2 Answers 94 Views
Docking
This is a migrated thread and some comments may be shown as answers.
RoxanaC
Top achievements
Rank 1
RoxanaC asked on 19 Oct 2010, 07:50 AM
Hello!
Since the Telerik documentation having this "How to" referring to adding a menu item to RadPane's menu is obsolete because is using the CustomMenuCommand I have a question for you.

I am adding a RadMenuItem to the template I use for all the radpanes as follows:
<DataTemplate x:Key="PaneContextMenuTemplate">
            <telerik:RadContextMenu InheritDataContext="False">
                <telerik:RadMenuItem IsChecked="{Binding IsInDocumentHost}"
                                     Command="telerikDocking:RadDockingCommands.TabbedDocument"
                                     CommandParameter="{Binding}"
                                     CommandTarget="{Binding}"
                                     Header="{Binding Command.Text,              RelativeSource={RelativeSource Self}}" />             
                <telerik:RadMenuItem IsCheckable="False"
                                     Header="Change header name"
                                     Click="RadMenuHeaderChange_Click" />
            </telerik:RadContextMenu>
        </DataTemplate>


In RadMenuHeaderChange_Click method I need to get somehow the RadPane that owns the RadContextMenu that has been opened. 
How can I achieve that?

Thank you!
Roxana

2 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 21 Oct 2010, 12:51 PM
Hi Roxana,

 The context menu of the pane is not designed to work with the Click event of the menu item, but with its Command property. When you are using the command you might pass the Pane using the command parameter like we do with the default items.

Kind regards,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
RoxanaC
Top achievements
Rank 1
answered on 23 Oct 2010, 06:42 AM
I found out myself

RadContextMenu menu = (RadContextMenu)((RadMenuItem) sender).Menu;
RadPane radPane = (RadPane)menu.PlacementTarget;

Thank you!
Roxana
Tags
Docking
Asked by
RoxanaC
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
RoxanaC
Top achievements
Rank 1
Share this question
or