I am trying to write a HeaderTemplate for an expander. So far, I have noticed that all examples use the {Binding} keyword to retrieve data from the header. However, what happens if there are several controls in the header? How to indicate that these controls should be inserted in a specific place?
<Window.Resources> <Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> </DataTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Expander Style="{StaticResource ExpanderStyle}"> <Expander.Header> <StackPanel Orientation="Horizontal"> <TextBlock>Some Text</TextBlock> <TextBlock Text="{Binding SomeBinding}" /> <Button /> </StackPanel> </Expander.Header> <Image Source="https://www.google.com/logos/2012/steno12-hp.jpg" /> </Expander>
Should I move the binding to a HeaderTemplate in style and just rewrite all Header in Expander ?
sohum source share