Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Is this what you want? Notice the GridSplitter property ResizeBehavior.</p> <pre><code>&lt;Grid &gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="5*"/&gt; &lt;ColumnDefinition Width="auto"/&gt; &lt;ColumnDefinition Width="2*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TreeView&gt; &lt;TreeViewItem Header="1"&gt; &lt;TreeViewItem Header="2"&gt; &lt;TreeViewItem Header="3"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="3"&gt; &lt;TreeViewItem Header="4"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="5"/&gt; &lt;TreeViewItem Header="6"/&gt; &lt;/TreeViewItem&gt; &lt;/TreeView&gt; &lt;GridSplitter Grid.Column="1" Width="10" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"/&gt; &lt;Canvas Grid.Column="2" Background="LightGray"/&gt; &lt;/Grid&gt; </code></pre> <p>Edit: Here is a working example, showing both approaches. If this is not what you want, then please say so.</p> <pre><code>&lt;Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfApplication1.MainWindow" Title="MainWindow" d:DesignWidth="516" d:DesignHeight="310"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="auto"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Label Content="Change size of content"/&gt; &lt;Border BorderBrush="Black" BorderThickness="1" Grid.Row="1" Margin="10"&gt; &lt;Expander Header="Expander" &gt; &lt;Grid &gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="5*"/&gt; &lt;ColumnDefinition Width="auto"/&gt; &lt;ColumnDefinition Width="2*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TreeView&gt; &lt;TreeViewItem Header="1"&gt; &lt;TreeViewItem Header="2"&gt; &lt;TreeViewItem Header="3"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="3"&gt; &lt;TreeViewItem Header="4"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="5"/&gt; &lt;TreeViewItem Header="6"/&gt; &lt;/TreeViewItem&gt; &lt;/TreeView&gt; &lt;GridSplitter Grid.Column="1" Width="10" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"/&gt; &lt;Canvas Grid.Column="2" Background="LightGray"/&gt; &lt;/Grid&gt; &lt;/Expander&gt; &lt;/Border&gt; &lt;Label Content="Change size of expander" Grid.Column="1"/&gt; &lt;Border BorderBrush="Black" BorderThickness="1" Grid.Row="1" Grid.Column="1" Margin="10"&gt; &lt;Grid &gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="5*"/&gt; &lt;ColumnDefinition Width="auto"/&gt; &lt;ColumnDefinition Width="2*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Expander&gt; &lt;TreeView&gt; &lt;TreeViewItem Header="1"&gt; &lt;TreeViewItem Header="2"&gt; &lt;TreeViewItem Header="3"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="3"&gt; &lt;TreeViewItem Header="4"/&gt; &lt;/TreeViewItem&gt; &lt;TreeViewItem Header="5"/&gt; &lt;TreeViewItem Header="6"/&gt; &lt;/TreeViewItem&gt; &lt;/TreeView&gt; &lt;/Expander&gt; &lt;GridSplitter Grid.Column="1" Width="10" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"/&gt; &lt;Canvas Grid.Column="2" Background="LightGray"/&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre>
 

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