DoubleEditBox Set font color - foreground

Editors for WPF Forum

Posted 1 year ago by Neil Larson
Version: 19.1.0683
Platform: .NET 4.8
Environment: Windows 10 (64-bit)
Avatar

<editors:DoubleEditBox x:Name="DefaultDwellTime" Height="17"
SmallChange="0.1" LargeChange="1" Format="F1" SpinnerVisibility="Visible"
Minimum="0.1" Maximum="5.0" IsEditable="True" IsNaNAllowed="False"
Background="Black" Foreground="White" BorderBrush="{DynamicResource BorderBrush}" >

If I want to implement a dark mode, I would like to change the font color, the background, the focused background etc. 

Foreground does not seem to change the text to any color. What do I need to do to change the colors of the parts?

Comments (1)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Neil,

The problem here is that thre are many foreground and background brushes that come into play with the edit boxes.  You don't really want to do theming with the Foreground/Background properties, as they won't hit all the brushes.  Instead, you want to alter all our Brush theme resources defined in the AssetResourceKeys that apply to edit boxes.  That's how we achieve theming.

These would be resources like:

  • AssetResourceKeys.EditBackground*
  • AssetResourceKeys.EditBorder*
  • AssetResourceKeys.ControlForeground*
  • AssetResourceKeys.DropDown*

You can modify the resources per the documentation like this in your App.Resources:

<SolidColorBrush x:Key="{x:Static themes:AssetResourceKeys.ControlForegroundNormalBrushKey}" Color="Red" />


Actipro Software Support

The latest build of this product (v2020.1.0) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.