I would like to create a simple control that inherits from HeaderedContentControl and has some basic dependency properties called Title, Subtitle, Icon. I would like to be able to provide a default header template that binds these properties to data. In this example, I named this class HeaderedView.
I'm having trouble providing a default header template that can bind to properties defined in the HeaderedView. I am experimenting with markup as follows:
<Style TargetType="{x:Type local:HeaderedView}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type HeaderedContentControl}">
<StackPanel>
<Grid>
<ContentPresenter ContentSource="Header"/>
</Grid>
<Grid>
<ContentPresenter ContentSource="Content"/>
</Grid>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<TextBlock Text="{TemplateBinding local:HeaderedView.Title}" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
Sorry, the title is not displayed.
The header template needs to be replaced (so I want to use HeaderedContentControl).
, , , , , . !