Shai UI
Shai UI

Reputation: 51948

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 / what's the difference?

Upvotes: 1

Views: 476

Answers (1)

Chris Sainty
Chris Sainty

Reputation: 9336

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?

Upvotes: 1

Related Questions