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

RadPane Context Menu

3 Answers 114 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Hardik
Top achievements
Rank 1
Hardik asked on 31 Jan 2012, 09:27 AM
Hi,

I am trying to add a custom context menu item (Setting) in a RadPane dock control MenuItem.

I am stuck at to attached the custom contextMenu item.

Following is the code which I did :

 public class ViewPartSettingMenuCommand : RoutedUICommand
  {  
    public ViewPartSettingMenuCommand() :
      base("Settings""ViewPartSettingMenuCommand"typeof(ViewPartSettingMenuCommand))
    {
    }
  }

In the constructor of the view :
 CommandManager.SetCommandBindings(thisthis.GetCommandBindings());
 public CommandBindingCollection GetCommandBindings()
    {
      CommandBindingCollection bindings = new CommandBindingCollection();
      bindings.Add(new CommandBinding(this.Resources["ViewPartSettingMenuCommand"as ViewPartSettingMenuCommandthis.OnViewPartSettingMenuCommandExecute));
      return bindings;
    }
In the resources :
<DataTemplate x:Key="XamlContextMenu">
            <telerik:RadContextMenu>
                <telerik:RadMenuItem Header="Floating"
                                               Command="telerik:RadDockingCommands.Floating" />
                <telerik:RadMenuItem Header="Dockable"
                                               Command="telerik:RadDockingCommands.Dockable" />
                <telerik:RadMenuItem x:Name="ViewPartSettingMenuCommand" />
            </telerik:RadContextMenu>
        </DataTemplate>
in the RadPane :
<telerik:RadPane x:Name="XamlPane" CanFloat="False" ContextMenuTemplate="{StaticResource XamlContextMenu}">
                            
I have referred the following link:
http://www.telerik.com/help/silverlight/raddocking-how-to-add-menu-items-to-the-radpanes-menu.html

Thanks
H@rdik Pancholi

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 03 Feb 2012, 09:45 AM
Hello,

Could you please share with us what difficulties do you experience: the menu is not showing, the commands are not working, or something else. If you could send us some more code related to the issue it will be helpful for tracking down the source of the issue.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Hardik
Top achievements
Rank 1
answered on 06 Feb 2012, 08:20 AM
Hi,

When I am binding the command "CommandManager.SetCommandBindings(thisthis.GetCommandBindings()); ",

I am getting an exception :

"Value cannot be null.
Parameter name: command"

Thanks.
H@rdik Pancholi.
0
Boyan
Telerik team
answered on 07 Feb 2012, 09:05 PM
Hi,

We have answered in your support thread however I will post the modified project here as well if someone else needs it.

Greetings,
Boyan
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
Docking
Asked by
Hardik
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Hardik
Top achievements
Rank 1
Boyan
Telerik team
Share this question
or