Note that there are some explanatory texts on larger screens.

plurals
  1. POAllow users to resize Expander in WPF
    primarykey
    data
    text
    <p>I have a lot of C# and WinForms experience but am a newbie to WPF. I have a Window with an Expander which expands downward. Much like the question box I'm currently typing in, I'd like users to be able to dynamically resize the Expander by clicking over a glyph at the bottom (like this question box) and dragging the expander to the desired size.</p> <p>Can anyone provide the XAML (and any additional code) to do this?</p> <p>This is what I have so far:</p> <pre><code>&lt;Expander Header="Live Simulations" Name="expandLiveSims" Grid.Row="0" ExpandDirection="Down" IsExpanded="True"&gt; &lt;Expander.Background&gt; &lt;LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"&gt; &lt;GradientStop Color="White" Offset="0" /&gt; &lt;GradientStop Color="LightGray" Offset="0.767" /&gt; &lt;GradientStop Color="Gainsboro" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/Expander.Background&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;DataGrid Height="250" Margin="5" Name="gridLiveProducts" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0"&gt; &lt;/DataGrid&gt; &lt;GridSplitter Grid.Row="0" Grid.Column="1" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"&gt; &lt;GridSplitter.Background&gt; &lt;LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"&gt; &lt;GradientStop Color="White" Offset="0" /&gt; &lt;GradientStop Color="DarkGray" Offset="0.25" /&gt; &lt;GradientStop Color="DarkGray" Offset="0.75" /&gt; &lt;GradientStop Color="Gainsboro" Offset="1" /&gt; &lt;!-- Gainsboro matches the expander --&gt; &lt;/LinearGradientBrush&gt; &lt;/GridSplitter.Background&gt; &lt;/GridSplitter&gt; &lt;Border Grid.Row="0" Grid.Column="2" Background="White" BorderBrush="Black" BorderThickness="1" Margin="5" &gt; &lt;Image Height="250" HorizontalAlignment="Right" Name="imgShares" Stretch="Fill" VerticalAlignment="Top" Width="250"&gt; &lt;/Image&gt; &lt;/Border&gt; &lt;GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3"&gt; &lt;GridSplitter.Background&gt; &lt;LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"&gt; &lt;GradientStop Color="Gainsboro" Offset="0" /&gt; &lt;GradientStop Color="DarkGray" Offset="0.25" /&gt; &lt;GradientStop Color="DarkGray" Offset="0.75" /&gt; &lt;GradientStop Color="Gainsboro" Offset="1" /&gt; &lt;/LinearGradientBrush&gt; &lt;/GridSplitter.Background&gt; &lt;/GridSplitter&gt; &lt;/Grid&gt; &lt;/Expander&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload