2011-02-23 127 views
1

里面的App.xaml我可能有:WPF:控件模板VS样式的更改模板

<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> 

与正要

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

我很困惑,我应该用/有什么区别?

回答

1

使用样式,你也可以同时改变按钮的其他值。 使用ControlTemplate只能更改模板。 那么哪个合适?