WPF resize GUI with delimiter
I am creating a WPF GUI and I would like to have a section where I can resize the width manually, similar to how most IDEs have searchers and toolbars that can be resized.
I am currently using DockPaneland, my project is similar to the image below. What should I do, including some kind of selector that can change the width of one section of my DockPanel. Are their WPF XAML components like delimiters capable of doing this already?
+3
source to share
1 answer
Grid and GridSplitter - Resizing behavior and Alignment Stretching on Grid Splitter are minor bugs, so an example is worth it:
<Window x:Class="GridSplitSpike.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ContentControl Name="LeftHandArea" Grid.Column="0" MinWidth="100"/>
<GridSplitter Grid.Column="1" ResizeBehavior="PreviousAndNext" VerticalAlignment="Stretch" Width="4" />
<DockPanel Grid.Column="2"/>
</Grid>
</Window>
I have to point out that ContentControl simply represents your left view. It will no longer be part of the DockPanel.
+5
source to share