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

Menu-items disabled after losing focus

4 Answers 107 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Aardlek
Top achievements
Rank 1
Aardlek asked on 03 Feb 2011, 11:27 AM
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;
       }

4 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 08 Feb 2011, 09:41 AM
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>>
0
Aardlek
Top achievements
Rank 1
answered on 08 Feb 2011, 10:24 AM
Sample project with readme file included.

sample project
0
Accepted
Hristo
Telerik team
answered on 08 Feb 2011, 03:15 PM
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>>
0
Aardlek
Top achievements
Rank 1
answered on 08 Feb 2011, 04:30 PM
Hristo,

Thank you very much for the help!

Aardlek
Tags
Menu
Asked by
Aardlek
Top achievements
Rank 1
Answers by
George
Telerik team
Aardlek
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or