我正在将 WinForms 应用程序迁移到 WPF。到目前为止,一切都进展顺利,除了我尝试使用 GridSplitter 时,我永远无法在运行时调整任何东西的大小。
为了确保它不仅仅是我的代码,我尝试从 LearnWPF.com 编译GridSplitter 示例,但它似乎也不起作用。当我将鼠标悬停在不会发生的拆分器上时,我希望看到标准的调整大小光标,并且据我所知,窗口中也没有拆分器的其他视觉表示。
我在这里想念什么?
<Window x:Class="UI.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="300" Width="300">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Background="#feca00" Grid.Column="0">
<TextBlock FontSize="35" Foreground="#58290A"
TextWrapping="Wrap">Left Hand Side</TextBlock>
</StackPanel>
<GridSplitter/>
<Border CornerRadius="10" BorderBrush="#58290A"
BorderThickness="5" Grid.Column="1">
<TextBlock FontSize="25" Margin="20" Foreground="#FECA00"
TextWrapping="Wrap">Right Hand Side</TextBlock>
</Border>
</Grid>