Author : Admin

How can I bind the Expander’s header element’s Width to the ActualWidth of the Expander ?


[XAML]
<Expander>
           <Expander.Header>
               <TextBlock Text="Expander header content" Background="AliceBlue"
                          Width="{Binding
                          RelativeSource={RelativeSource
                          Mode=FindAncestor,
                          AncestorType={x:Type Expander}},
                          Path=ActualWidth}"/>
           </Expander.Header>
 
           <TextBlock Background="Gray" Text="Expander body content"/>
            
</Expander>