xctk:IntegerUpDown borderbrush不显示颜色

时间:2013-08-23 02:23:49

标签: wpf c#-4.0 wpftoolkit

我尝试使用以下代码将颜色设置为xctk:IntegerUpDown控件的边框。

<Style TargetType="{x:Type xctk:IntegerUpDown}" >
    <Setter Property="Background" Value="{StaticResource WindowBrush}" />
    <Setter Property="Foreground" Value="{StaticResource TextBrush}" />
    <Setter Property="BorderBrush" Value="Green"/>
    <Setter Property="BorderThickness" Value="5"/>
</Style>

BorderThickness正确显示但边框颜色未按指定显示。 我一定错过了什么。有人可以帮忙吗?

谢谢,

1 个答案:

答案 0 :(得分:0)

可能你使用2.0.0以下的版本。此问题已通过2.0.0版解决。

版本2.0.0,您可以下载here

下面是代码片段,您可以看到2.0.0以下的版本缺少绑定到模板BorderBrush(BorderBrush="{TemplateBinding BorderBrush}")。

2.0.0版实施(source code):

<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实施(source code):

<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}}">
        ...