Cannot change the style for is mouse over for Int32EditBox background

Editors for WPF Forum

Posted 9 years ago by agilent user
Version: 14.2.0611
Avatar

Hi My style.trigger code as below, but when mouse over, the background is no change, may i know is which part have problem cause it cannot function?
<Style.Triggers>
<Trigger Property="editors:Int32EditBox.IsMouseOver" Value="True">
<Setter Property="editors:Int32EditBox.BorderBrush">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Color="#FF279ED4" Offset="0"/>
<GradientStop Color="#FF279ED4" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="editors:Int32EditBox.Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,0">
<GradientStop Color="#FF2B2B2B" Offset="0"/>
<GradientStop Color="#FF171717" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="editors:Int32EditBox.IsEnabled" Value="False">
<Setter Property="editors:Int32EditBox.Background" >
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,0" Opacity="0.5">
<GradientStop Color="#FF2B2B2B" Offset="0"/>
<GradientStop Color="#FF171717" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="editors:Int32EditBox.IsFocused" Value="True">
<Setter Property="editors:Int32EditBox.BorderBrush">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Color="#FF279ED4" Offset="0"/>
<GradientStop Color="#FF279ED4" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="editors:Int32EditBox.Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,0">
<GradientStop Color="#FF2B2B2B" Offset="0"/>
<GradientStop Color="#FF171717" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>

Comments (3)

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

Hello, but that won't work because the default template for the edit box controls use triggers to alter the backgrounds, which override what you are trying to do.  You would need to clone our default style/template, alter them to your needs, and put the resulting implicit style in your app's Resources.

There also is a simpler way if you just want to change background brushes.  Per the samples in our Themes section, you can redefine brush asset resources.  We use these kinds of brushes for backgrounds, so redefining them in your app's Resources would get the updated versions into all your edit controls:

{DynamicResource {x:Static themes:AssetResourceKeys.EditBackgroundNormalBrushKey}}

{DynamicResource {x:Static themes:AssetResourceKeys.EditBackgroundDisabledBrushKey}}

{DynamicResource {x:Static themes:AssetResourceKeys.EditBackgroundFocusedBrushKey}}

{DynamicResource {x:Static themes:AssetResourceKeys.EditBackgroundHoverBrushKey}}


Actipro Software Support

Posted 9 years ago by agilent user
Avatar

Hi Thanks for your reply.

 

May i know that will actipro theme override my other normal control example button (normal WPF button) mouser over effect?

[Modified 9 years ago]

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

Hello,

We do provide optional Styles for the native WPF controls to keep everything looking consistent across your app.  They are not enabled by default but you can activate that feature if you set ThemeManager.AreNativeThemesEnabled to true.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.