我有一个可以调整大小的WPF窗口:
<Window x:Class="WpfTester.BadResize"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BadResize"
Height="300"
Width="600"
MinWidth="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="250" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Left Panel" />
<GridSplitter Grid.Column="1"
ResizeDirection="Columns"
Width="3"
HorizontalAlignment="Stretch" />
<TextBox Grid.Column="2"
TextWrapping="Wrap"
Text="Test text test text test text test text test text test text test text test text test text text test text test text test text" />
</Grid>
</Window>
这个窗口有一个左右两个面板的网格和它们之间的GridSplitter。我运行程序:
![enter image description here](https://istack.dev59.com/Gb0Oo.webp)
Width="{Binding ActualWidth, ElementName=test, Mode=OneWay}"
。 - ASh