Change foreground color of EnumEditBox

Editors for WPF Forum

Posted 2 years ago by Kristoffer
Version: 22.1.1
Avatar

I'm trying to change the foreground color of a EnumEditBox, but it will not change. When looking at the Live Visual Tree, the Foreground color is set correctly on the style. But there is another Foreground Color on the TextBox under Local. Any suggestions for how I can achieve this?

This is the code I'm using.

    <UserControl.Resources>
        <Style x:Key="ErrorEnumEditBox" TargetType="editors:EnumEditBox" BasedOn="{StaticResource {x:Type editors:EnumEditBox}}">
            <Setter Property="Value" Value="{Binding Value, ValidatesOnExceptions=True}"/>
            <Setter Property="ToolTip" Value="{Binding TooltipText}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarButtonForegroundDisabledBrushKey}}" />
        </Style>
    </UserControl.Resources>

    <editors:EnumEditBox Grid.Column="1" TextAlignment="Right" Margin="0,0,2,0" Style="{StaticResource ErrorEnumEditBox}"></editors:EnumEditBox>

Comments (1)

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

Hello,

We found the problem in the edit box templates where a Trigger is preventing the externally set Foreground from being pushed down, but only for non-editable edit boxes.  We have made an update for the next maintenance release that will allow your Foreground to flow through, even in non-editable edit boxes.


Actipro Software Support

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.