DropDownButton MenuItem IsChecked Binding

May 10, 2010 at 7:04 AM

Hi,

I want to bind the IsChecked Property of a MenuItem with PropertyChanged but does not work. I have some MenuItems added to a DropDownButton (via XAML) and only want to check one of this items at same time. How can I achieve this?

Example:

        <r:SplitButton cc:Action.TargetWithoutContext="{Binding Source={StaticResource bridge}, Path=DataContext}" x:Name="Quality" Text="{x:Static loc:MyResource.Quality}" Icon="../Images/img.ico" LargeIcon="../Images/img.ico" >
          <r:MenuItem Text="{x:Static loc:MyResource.Quality1}" Icon="../Images/img.ico" IsChecked="{Binding Quality1Checked}"                      
                      cc:Message.Attach="[Event Click]=[Action SetQuality($source)];[Event Checked]=[Action UncheckQuality($source)]" IsCheckable="True" />
          <r:MenuItem Text="{x:Static loc:MyResource.Quality2}" Icon="../Images/img.ico"  IsChecked="{Binding Quality2Checked}"                       
                      cc:Message.Attach="[Event Click]=[Action SetQuality($source)];[Event Checked]=[Action UncheckQuality($source)]" IsCheckable="True"/>
          <r:MenuItem Text="{x:Static loc:MyResource.Quality3}" Icon="../Images/img.ico" IsChecked="{Binding Quality3Checked}"                       
                      cc:Message.Attach="[Event Click]=[Action SetQuality($source)];[Event Checked]=[Action UncheckQuality($source)]" IsCheckable="True"/>
          <r:MenuItem Text="{x:Static loc:MyResource.Quality4}" Icon="../Images/img.ico"  IsChecked="{Binding Quality4Checked}"                       
                      cc:Message.Attach="[Event Click]=[Action SetQuality($source)];[Event Checked]=[Action UncheckQuality($source)]" IsCheckable="True"/>         
        </r:SplitButton>

Thanks Alex

Coordinator
May 12, 2010 at 5:52 PM
Do you want GroupName property to group MenuItems to be sure that only one is checked? Or your bindings do not work? Daniel
May 18, 2010 at 8:00 AM

I got it worked with the latest version!! It was a problem with TabItems binding!