XAML Irritation

Can anyone explain the following:

<Style TargetType="{x:Type Button}"
          BasedOn="{StaticResource FontStyle}">
  <Setter Property="Template">
    <Setter.Value>
       <!-- wont work without
            respecifying the TargetType...?-->
       <ControlTemplate TargetType="{x:Type Button}">
         <Border Background="{TemplateBinding Property=Background}">
           <ContentPresenter/>
         </Border>
       </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

As in – why does the TargetType have to be restated in the ControlTemplate? The expected type of object in the control template is just Control, the error says that Control doesn’t have a Content property.

This entry was posted in Uncategorized, WPF and tagged , , . Bookmark the permalink.

Leave a Reply