[英]Null values for integers are not displayed properly by the Telerik NumericUpDown control
[英]Styling Telerik WPF NumericUpDown Control
我使用Telerik WPF控件,并且需要在UI中添加NumericUpDown控件。 问题是,按原样使用时,它在视觉上不适合应用程序的其余部分
<TL;DR> This is a bigger application, that's not been written fully by me. Other people somehow managed to "import" other telerik controls and assign them other styles. Sadly, nobody's used the UpDown control before. </>
我将控件添加到我的UI:
<telerik:RadNumericUpDown
Minimum="0"
Maximum="10"
SmallChange="1"
NumberDecimalDigits="0"
IsInteger="True"
Value="{Binding Path=Counter}" />
另外,我在ResourceDictionary中添加了一些样式:
<Style TargetType="{x:Type telerikInput:RadNumericUpDown}">
<Setter Property="Padding" Value="1"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Border.CornerRadius" Value="2" />
<Setter Property="Border.Background" Value="{StaticResource ControlBackgroundBrush}" />
<Setter Property="Border.BorderBrush" Value="{StaticResource SolidBorderBrush}" />
<Setter Property="Border.BorderThickness" Value="1" />
</Style>
这可以处理一些基本的样式功能(边框,边距等)。 一般来说,它看起来“足够好”。 仅有一个问题-当鼠标指针悬停在控件上时,它将变得有光泽和光泽。 那与我的其他控件的行为不同-是否有一种简单的方法可以消除这种影响?
我尝试过使用触发器:
<Style>
...
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red" />
<Setter Property="Border.BorderBrush" Value="Black" />
...
</Style.Triggers>
</Style>
但这并没有太大作用。 我也尝试过设置IncreaseButtonContentTemplate字段,但是结果也不是很好。
您需要修改默认的ControlTemplates
并从中删除任何“光泽和光泽”效果。 最简单的方法是将默认模板从Telerik安装目录中的Themes.Implicit
文件夹复制到解决方案中,然后根据需要进行编辑。
恐怕您没有可以简单地在控件上设置的“ DisableEffects”属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.