Menu-items disabled after losing focus

5 posts, 1 answers
  1. Aardlek
    Aardlek avatar
    3 posts
    Member since:
    Sep 2010

    Posted 03 Feb 2011 Link to this post

    Hello,

    I've got a WPF application with  radmenu and a radgrid. (v.2010.3.110.35)
    When I click on a row in te grid, the menu-items are disabled in the main-menu, when I drag a column from the grid on the grouping header and remove it again the menu-items in de main menu are enabled again.

    What could cause this problem?

    I am using the code below to create the menu. 
    var cba = new CommandBinding(MenuCommands.TileView, GoToPageExecuteHandler, GoToPageCanExecuteHandler);
                CommandBindings.Add(cba);
                var cbas = new CommandBinding(MenuCommands.Search, GoToPageExecuteHandler, GoToPageCanExecuteHandler);
                CommandBindings.Add(cbas);

    MenuResources.Culture = Thread.CurrentThread.CurrentCulture;
                   var baseItem = new RadMenuItem();
                   var TileView = new RadMenuItem();
                   var Search = new RadMenuItem();
                   var Carousel = new RadMenuItem();
                   baseItem.Header = MenuResources.Base;
                   //TileView
                   TileView.Command = MenuCommands.TileView;
                   TileView.CommandParameter = MenuUrls.Url(MenuResources.InTileView);
                   TileView.Header = MenuResources.InTileView;
                   TileView.IsEnabled = true;
                   baseItem.Items.Add(TileView);
                   //Search
                   Search.Command = MenuCommands.Search;
                   Search.CommandParameter = MenuUrls.Url(MenuResources.Search);
                   Search.Header = MenuResources.Search;
                   Search.IsEnabled = true;
                   baseItem.Items.Add(Search);
                   ApplicationMenu.Items.Insert(0, baseItem);
                   MenuCommands.MenuSet = true;

    private void GoToPageCanExecuteHandler(object sender, CanExecuteRoutedEventArgs e)
           {
               e.CanExecute = true;
           }

  2. George
    Admin
    George avatar
    1332 posts

    Posted 08 Feb 2011 Link to this post

    Hello Aardlek,

     
    Could you please give us more detailed information about your scenario. We will greatly appreciate a sample project of yours. It will definitely help us in further pinpointing and resolving the problem. Can you attach the sample project to this thread? 


    Best wishes,
    George
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Aardlek
    Aardlek avatar
    3 posts
    Member since:
    Sep 2010

    Posted 08 Feb 2011 Link to this post

    Sample project with readme file included.

    sample project
  5. Answer
    Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 08 Feb 2011 Link to this post

    Hello Aardlek,

    You are attaching the command bindings on Menu.xaml class. But then when RadMenu lose focus this commands will not be evaluated. Instead you should add them in the MainWindow.

    I'm attaching a modified version of your project.

    Let us know if you need more help.

    Regards,
    Hristo
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Aardlek
    Aardlek avatar
    3 posts
    Member since:
    Sep 2010

    Posted 08 Feb 2011 Link to this post

    Hristo,

    Thank you very much for the help!

    Aardlek
Back to Top
UI for WPF is Visual Studio 2017 Ready