Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a WPF Expander Stretch?

The Expander control in WPF does not stretch to fill all the available space. Is there any solutions in XAML for this?

like image 663
coder_bro Avatar asked Mar 25 '09 07:03

coder_bro


1 Answers

All you need to do is this:

<Expander>   <Expander.Header>     <TextBlock       Text="I am header text..."       Background="Blue"       Width="{Binding         RelativeSource={RelativeSource           Mode=FindAncestor,           AncestorType={x:Type Expander}},         Path=ActualWidth}"       />   </Expander.Header>   <TextBlock Background="Red">     I am some content...   </TextBlock> </Expander> 

http://joshsmithonwpf.wordpress.com/2007/02/24/stretching-content-in-an-expander-header/

like image 160
Jonathan Parker Avatar answered Sep 28 '22 02:09

Jonathan Parker