bug in radmenuitem command binding at raisecanexecutechanged

6 posts, 1 answers
  1. MATEUSZ
    MATEUSZ avatar
    18 posts
    Member since:
    Jul 2011

    Posted 13 Mar 2012 Link to this post

    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?
  2. MATEUSZ
    MATEUSZ avatar
    18 posts
    Member since:
    Jul 2011

    Posted 14 Mar 2012 Link to this post

    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)
  3. UI for WPF is Visual Studio 2017 Ready
  4. Answer
    George
    Admin
    George avatar
    1332 posts

    Posted 19 Mar 2012 Link to this post

    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 >>
  5. Radek
    Radek avatar
    7 posts
    Member since:
    Apr 2011

    Posted 21 Mar 2012 Link to this post

    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?
  6. George
    Admin
    George avatar
    1332 posts

    Posted 26 Mar 2012 Link to this post

    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 >>
  7. Radek
    Radek avatar
    7 posts
    Member since:
    Apr 2011

    Posted 27 Mar 2012 Link to this post

    Thank You, I'm stupid :)
Back to Top
UI for WPF is Visual Studio 2017 Ready