可能您使用的版本低于 2.0.0。2.0.0 版解决了这个问题。
版本 2.0.0 你可以在这里下载。
下面是代码片段,您可以看到 2.0.0 以下版本缺少与模板 BorderBrush ( BorderBrush="{TemplateBinding BorderBrush}"
) 的绑定。
2.0.0版本实现(源码):
<Style x:Key="NumericUpDown" TargetType="{x:Type prim:InputBase}">
<Setter Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlNormalBackgroundKey}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlNormalBorderKey}}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Right" />
<Setter Property="WatermarkTemplate" Value="{StaticResource DefaultWatermarkTemplate}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<local:ButtonSpinner x:Name="PART_Spinner"
IsTabStop="False"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}"
ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}">
...
1.9.0版本实现(源码):
<Style x:Key="NumericUpDown" TargetType="{x:Type prim:InputBase}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Right" />
<Setter Property="WatermarkTemplate" Value="{StaticResource DefaultWatermarkTemplate}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<local:ButtonSpinner x:Name="PART_Spinner"
IsTabStop="False"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}"
ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}">
...