Access current theme background color of Ribbon

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 12 years ago by Brad Salmon
Version: 12.2.0570
Avatar

I want to be able to define styles for the TabControl, DocumentWindow, etc. used in my app so that the background color matches the background color of the Ribbon control for the current theme of the app.  In addition, I have some triggers that set the background of my edit controls when the control is readonly:

<Style TargetType="editors:TextBox">
    <Style.Triggers>
        <Trigger Property="IsReadOnly" Value="true">
            <Setter Property="Control.Background" >
                <Setter.Value>
                    <SolidColorBrush Color="#FFF9F9F9"/>
                </Setter.Value>
           </Setter> 
           <Setter Property="Control.FontWeight" Value="SemiBold" />
        </Trigger>
    </Style.Triggers>
</Style>

 

As you can see above, I have the brush color hardcoded but I want to be able to have it match whatever the background color of the ribbon control that my app is using.

Is this possible?

- Brad

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Brad,

All our brushes are assets from a reusable resource pool as described in the Themes documentation.  So for instance you can reference a brush like:

Background="{DynamicResource {x:Static themes:AssetResourceKeys.RibbonBackgroundNormalBrushKey}}"

Or if this TextBox is on a Ribbon, you could just make its background transparent instead.


Actipro Software Support

Posted 12 years ago by Brad Salmon
Avatar

Perfect! Thanks.

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.