样式化Telerik WPF数字上下控制

样式化Telerik WPF数字上下控制,wpf,xaml,telerik,numericupdown,wpf-style,Wpf,Xaml,Telerik,Numericupdown,Wpf Style,我使用Telerik WPF控件,需要在UI中添加NumericUpDown控件。问题是,当“按原样”使用时,它在视觉上不适合应用程序的其余部分 这是一个更大的应用程序,还没有完全由我编写。其他人不知何故设法“导入”了其他telerik控件,并为它们分配了其他样式。遗憾的是,以前没有人使用过上下控制。 我将控件添加到我的UI中: <telerik:RadNumericUpDown Minimum="0" Maximum="10" SmallChange="1" Numb

我使用Telerik WPF控件,需要在UI中添加NumericUpDown控件。问题是,当“按原样”使用时,它在视觉上不适合应用程序的其余部分


这是一个更大的应用程序,还没有完全由我编写。其他人不知何故设法“导入”了其他telerik控件,并为它们分配了其他样式。遗憾的是,以前没有人使用过上下控制。

我将控件添加到我的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”属性。

请尝试使用
确定,这样看来我就无法从零开始重新实现样式了。谢谢。普菲。。。。那会很有趣的…;)