I'm trying to make a very simple two-column window, in which the right column starts at width 150, with a minimum width of 150, the left column fills the remaining space, with a minimum width of 300, and a GridSplitter allows resizing the two columns.
I'm running into two issues here.
When attempting to drag the GridSplitter to the left more than the left column's MinWidth allows, the GridSplitter stops as expected, but the right column keeps growing and overflowing the right bounds of the window and getting clipped.
When specifying a MinWidth for the window itself (which is equal to the MinWidth of the two content columns plus the column for the GridSplitter), I can resize the window just slightly smaller than I should be able to (maybe by 5-10 pixels), causing some of the right column's content to be clipped.
Are there some simple changes I need to make for this to behave properly?
<Window x:Class="CustomLabels.MainWindow"
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"
xmlns:local="clr-namespace:CustomLabels"
mc:Ignorable="d"
Title="Custom Labels" Height="350" Width="550" MinWidth="455" MinHeight="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="300" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="150" MinWidth="150" />
</Grid.ColumnDefinitions>
<TextBox x:Name="textBox" Height="23" Margin="81,14,90,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Grid.Column="0"/>
<Label x:Name="label" Content="Order No." HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" Grid.Column="0"/>
<Button x:Name="button" Content="Load" Margin="0,14,10,0" VerticalAlignment="Top" Height="23" HorizontalAlignment="Right" Width="75" Grid.Column="0"/>
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Center" VerticalAlignment="Stretch" />
<Label x:Name="label1" Content="Label" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontWeight="Bold" Width="47" Grid.Column="2" />
<ListBox x:Name="listBox" Margin="10,41,10,10" IsSynchronizedWithCurrentItem="True" Grid.Column="2" />
</Grid>
</Window>
Note that I have attempted to implement the solution shown in this question, but it doesn't appear to have any effect when I want the right column to start with a fixed width.