Is it possible to create a custom Label for an UnboundField? I have an implicit LabelPresenter style for the look of the xamDataGrid header, but I am looking to add a StackPanel with two textblocks to each of the Labels. In WPF DataGrid, I can change the HeaderTemplate to achieve this effect.
Hello,
I am just checking if you require any further assistance on the matter
Thank you for your feedback. Yes, you can pass the StackPanel to the ContentControl like e.g. :
<Style x:Key="style1" TargetType="{x:Type igDP:LabelPresenter}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel>
<TextBlock Text="Column"/>
<TextBlock Text="Book Name"/>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
If you been any further assistance on this matter, feel free to ask.
Thanks, the style works as expected but results in redundant styles for each field. I have an implicit style that defines the design of the LabelPresenter. Each column header has a simple stackpanel for both textblocks. The LabelPresenter has a ContentControl. Is there a way to pass the StackPanel to that ContentControl rather than re-styling the LabelPresenter?
Thank you for your post. I can suggest use the following style for the LebelPresenter in order to create a Label with a StackPanel with two Textblocks :
<Setter Property="Template">
<ControlTemplate TargetType="{x:Type igDP:LabelPresenter}">
<TextBlock Text="Book"/>
<TextBlock Text="Name"/>
</ControlTemplate>
If you need any further assistance on this matter, feel free to ask.