RadPane Context Menu

4 posts, 0 answers
  1. Hardik
    Hardik avatar
    61 posts
    Member since:
    Jun 2011

    Posted 31 Jan 2012 Link to this post

    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
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 Feb 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Hardik
    Hardik avatar
    61 posts
    Member since:
    Jun 2011

    Posted 06 Feb 2012 Link to this post

    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.
  5. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 07 Feb 2012 Link to this post

    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 >>
Back to Top