RadMenuItem not calling converter unless binding is set to two way

3 posts, 1 answers
  1. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 02 Feb 2011 Link to this post


    I have a problem with the RadContextMenu.  I have an RadMenuItem's IsEnabled property bound to an object and am using a converter to change that into a bool.  However, the converter never gets called unless I use TwoWay binding which is not possible.  Any ideas about this?  Below is my sample:

                                                <telerik:RadMenuItem Header="TEXT UNIT" FontSize="12" IsEnabled="{Binding RadioSystemType, Converter={StaticResource Enable_Texting_SysType}}" Command="{Binding Main.AddConversation, Mode=OneWay, Source={StaticResource Locator}}" CommandParameter="{Binding MakeKeyBindable, Mode=OneWay}" Click="TextUnitorGroup_Click"/>
                                                <telerik:RadMenuItem Header="SETTINGS" FontSize="12" CommandParameter="{Binding MakeKeyBindable, Mode=OneWay}" Command="{Binding Main.EditUnitCommand, Mode=OneWay, Source={StaticResource Locator}}"/>
                                                <telerik:RadMenuItem Header="FOLLOW UNIT" FontSize="12">
                                                    <telerik:RadMenuItem Header="TRACK IN WINDOW 1" FontSize="12" CommandParameter="{Binding Mode=OneWay}" Command="{Binding Main.FollowUnitWindow1Command, Mode=OneWay, Source={StaticResource Locator}}"/>
                                                    <telerik:RadMenuItem Header="TRACK IN WINDOW 2" FontSize="12" CommandParameter="{Binding Mode=OneWay}" Command="{Binding Main.FollowUnitWindow2Command, Mode=OneWay, Source={StaticResource Locator}}"/>
                                                <telerik:RadMenuItem Header="NEAREST ASSETS" FontSize="12" Click="RadMenuItem1_Click"/>
                                                <telerik:RadMenuItem Header="ADD UNIT" FontSize="12" Command="{Binding Main.AddUnitCommand, Mode=OneWay, Source={StaticResource Locator}}"/>
                                                <telerik:RadMenuItem Header="DELETE UNIT" FontSize="12" Command="{Binding Main.RemoveUnitCommand, Mode=OneWay, Source={StaticResource Locator}}" CommandParameter="{Binding MakeKeyBindable, Mode=OneWay}"/>           
  2. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 02 Feb 2011 Link to this post

    BTW I don't believe I understand how to use your Format Code Block.  I want to try and aid you in any way possible to help me so please a brief explanation.

    Adam Burdette
  3. Answer
    Hristo avatar
    832 posts

    Posted 02 Feb 2011 Link to this post

    Hello Adam,

    When Binding the Command property its CanExecute status changes IsEnabled property. So when CanExecute is changed IsEnabled is also changed. But this change clears the Binding that you have set in XAML. This can be fixed only in WPF 4.
    So you have 2 options - either use two way Bindings or if you want to disable the menu item use the Command CanExecute event and return false in its event args.

    Let us know if you need more information.

    Kind regards,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top