了borderThickness不起作用 [英] BorderThickness doesn't work

查看:150
本文介绍了了borderThickness不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建在XAML按钮样式,这里是我的code:

I'm trying to create style for button in XAML, here is my code:

<Window.Resources>
  <Style x:Key="buttons"
         TargetType="Control">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush>
          <GradientStop Color="GoldenRod"
                        Offset="0" />
          <GradientStop Color="Gold"
                        Offset="0.10" />
          <GradientStop Color="White"
                        Offset="0.45" />
          <GradientStop Color="Gold"
                        Offset="0.9" />
          <GradientStop Color="GoldenRod"
                        Offset="1" />

        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="FontFamily"
            Value="Consolas" />
    <Setter Property="FontSize"
            Value="15" />
    <Setter Property="FontWeight"
            Value="Bold" />
    <Setter Property="BorderThickness"
            Value="5" />
    <Setter Property="Padding"
            Value="0,0" />

  </Style>
</Window.Resources>

一切正常,除了borderThickness性能优良 - 无论什么价值我把那里,它不会改变。我想知道什么是我的code丢失。

Everything works fine except BorderThickness property - no matter what value I'm putting there, it doesn't change. I'm wondering what is missing in my code.

推荐答案

结帐的按钮控制默认模板这里。

Checkout the Button control default template here.

<一个href=\"http://msdn.microsoft.com/en-us/library/ms753328%28v=vs.90%29.aspx\">http://msdn.microsoft.com/en-us/library/ms753328%28v=vs.90%29.aspx

如果我们看到了borderThickness 属性被设置为固定值1。因此没有任何变化反映出来。

If we see BorderThickness property has been set to fixed value 1. Hence no changes are reflected.

您需要创建一个新的控件模板用于这一目的。

You need to create a new ControlTemplate for this purpose.

这篇关于了borderThickness不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆