This project is read-only.

Ribbon buttons and styles

Sep 11, 2010 at 11:25 PM

I may be all wrong, but I am trying to use styles for ribbon controls and it does not work properly for me,

The style for ordinary button sets Text correctly, but the second style for fluent button does not work (the button is not visible at all)

here is the code excerpt:

            <Style TargetType="{x:Type Fluent:Button}" x:Key="ribbonButtonCommandStyle" >
                <Setter Property="Text"    Value="asdf" />
            <Style TargetType="{x:Type Button}" x:Key="ribbonButtonCommandStyle2" >
                <Setter Property="Content"    Value="asdf" />

        <Button DockPanel.Dock="Top" Style="{StaticResource ResourceKey=ribbonButtonCommandStyle2}" ></Button>
        <Fluent:Ribbon DockPanel.Dock="Top">
                <Fluent:Button x:Name="newProjectButton"
                           Icon="{StaticResource ResourceKey=GenericDocument}"
                           Command="{x:Static Gui:XCaseApplicationCommands.NewProjectCommand}"
                           Style="{StaticResource ResourceKey=ribbonButtonCommandStyle}"
Sep 12, 2010 at 11:25 PM

Oh, I forgot to add the base style...

Sep 13, 2010 at 2:08 PM

Yep, you need to use basedon property

Mar 28, 2012 at 9:41 PM

Could you show an example?


Mar 30, 2012 at 3:24 PM

<Style TargetType="{x:Type Fluent:Button}" 
       BasedOn="{StaticResource RibbonButtonStyle}">
    <Setter Property="Text" Value="asdf" />


<Style TargetType="{x:Type Fluent:Button}" 
       BasedOn="{StaticResource {x:Type Fluent:Button}}">
    <Setter Property="Text" Value="asdf" />