RibbonMenuItem StaysOpenOnClick and IsCheckable

Sep 8, 2010 at 6:32 PM

I am having a problem using StaysOpenOnclick="true" and IsCheckable="true" it doesnt check this example should compile and demonstrate.

<ribbon:RibbonWindow x:Class="RibbonDate.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="MainWindow"
		x:Name="RibbonWindow"
		Width="640" Height="480">
	<ribbon:RibbonWindow.Resources>
	
		<Style x:Key="TestStyle" TargetType="{x:Type ribbon:RibbonMenuItem}">
			<Setter Property="IsCheckable" Value="True"/>
			
		</Style>
	</ribbon:RibbonWindow.Resources>

	<Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ribbon:Ribbon x:Name="Ribbon">
            
			
			<ribbon:RibbonTab Header="Test">
                <ribbon:RibbonGroup Header="Test">
                    <ribbon:RibbonMenuButton ItemContainerStyle="{StaticResource TestStyle}"   Label="Test">
                        <ribbon:RibbonMenuItem x:Name="a" StaysOpenOnClick="True" Header="Text1"  />
                        <ribbon:RibbonMenuItem x:Name="b" StaysOpenOnClick="True" IsChecked="True" Header="Text2"  />
                        <ribbon:RibbonMenuItem x:Name="c" StaysOpenOnClick="True" Header="Text3" />
                        <ribbon:RibbonMenuItem x:Name="d" StaysOpenOnClick="True" Header="Text4" />
                    </ribbon:RibbonMenuButton>
                </ribbon:RibbonGroup>
            </ribbon:RibbonTab>
        </ribbon:Ribbon> 
        
    </Grid>
</ribbon:RibbonWindow>

Sep 8, 2010 at 7:03 PM

I was able to workaround this using previewmousedown event to check it would rather not do that though so still looking for another solution.