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

bug in radmenuitem command binding at raisecanexecutechanged

5 Answers 189 Views
Menu
This is a migrated thread and some comments may be shown as answers.
MATEUSZ
Top achievements
Rank 1
MATEUSZ asked on 13 Mar 2012, 07:31 PM
Hi.
I'm using radmenu like this:
<telerik:RadMenu Grid.Column="0" VerticalAlignment="Center" IsTabStop="False" Orientation="Vertical">
    <telerik:RadMenu.Items>
        <telerik:RadMenuItem Header="Modyfikuj" Command="{Binding Path=StartEditPartCommand}"/>
        <telerik:RadMenuItem Header="Zatwierdź" Command="{Binding Path=CommitEditPartCommand}"/>
        <telerik:RadMenuItem Header="Anuluj" Command="{Binding Path=RejectEditPartCommand}"/>
    </telerik:RadMenu.Items>
</telerik:RadMenu>

so basically, i'm binding menu items to some commands which have canexecute method:
StartEditPartCommand = new DelegateCommand(
    /*foo*/,
    () => !IsEditingPart && SelectedItem != null);


somewhere in code, raisecanexecutechanged method is properly raised:
StartEditPartCommand.RaiseCanExecuteChanged();

and... it doesn't refresh menuitems' IsEnabled property - they remain in previous state. Sliding mouse cursor over menuitem causes menuitems refresh, but not always.

When having changed radmenu to itemscontrols/stackpanels with buttons everything works fine, so it's probably bug with radmenu or radmenuitem?

5 Answers, 1 is accepted

Sort by
0
MATEUSZ
Top achievements
Rank 1
answered on 14 Mar 2012, 07:53 PM
forgot to mention, that i'm using newest 2012 q1. today i tried applying newest hotfix, problem still occurs

and as far as i remember it worked fine on some previous version (2011 q3 or q2)
0
Accepted
George
Telerik team
answered on 19 Mar 2012, 08:28 AM
Hello,

I will paste the answer from the support ticket as well:

We tested the scenario and we can confirm that this bug is already fixed in our latest internal build.

Kind regards,
George
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Radek
Top achievements
Rank 1
answered on 21 Mar 2012, 09:54 AM
I have problem with MenuItem too.

<Style x:Key="MenuItemStyle">
   <Setter Property="MenuItem.Header" Value="{Binding Caption}"/>
   <Setter Property="MenuItem.ItemsSource" Value="{Binding Items}"/>
   <Setter Property="MenuItem.Command" Value="{Binding Command}" />
   <Setter Property="MenuItem.CommandParameter" Value="{Binding ViewModel}" />
</Style>

When I use standard menu in WPF it works. And commands opens new tile in my app.
<Menu x:Name="mnAdmin" IsMainMenu="True" DockPanel.Dock="Top">
    <MenuItem Header="_Admin" ItemsSource="{Binding CisMenu.Items}"  ItemContainerStyle="{StaticResource MenuItemStyle}"/>
</Menu>

But when I use this code. It doesn't works.
<telerik:RadMenu x:Name="mnAdmin" DockPanel.Dock="Top" >
   <telerik:RadMenuItem  Header="_Admin" ItemsSource="{Binding CisMenu.Items}"  ItemContainerStyle="{StaticResource MenuItemStyle}" />
</telerik:RadMenu>

It it same bug with you wrote above?
0
George
Telerik team
answered on 26 Mar 2012, 09:49 AM
Hello,

What I would suggest is targeting the RadMenuItem, not MenuItem in the Style setters. This should do the trick.


Regards,
George
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Radek
Top achievements
Rank 1
answered on 27 Mar 2012, 07:01 AM
Thank You, I'm stupid :)
Tags
Menu
Asked by
MATEUSZ
Top achievements
Rank 1
Answers by
MATEUSZ
Top achievements
Rank 1
George
Telerik team
Radek
Top achievements
Rank 1
Share this question
or