开发者

WPF: ControlTemplate vs Style that Changes Template

Inside App.xaml I may have:

<Style TargetType="{x:Type Button}" x:Key="roundButton">
  <Setter Property="Template">
     <Setter.Value>
        <ControlTemplate Target="{x:Type Button}">
            bla bla bla...
        </ControlTemplate>
     </Setter.Value>
  </Setter>
</Style>

vs. just going

<ControlTemplate Target="{x:Type Button}" x:Key="roundButton">
    bla bla bla...
</ControlTemplate>

I'm confused, which should I use开发者_如何学JAVA / what's the difference?


Using the Style you could also change other values of the button at the same time. Using the ControlTemplate you can only change the template. So which is appropriate?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜