gpt4 book ai didi

wpf - Gridsplitter 不调整大小

转载 作者:行者123 更新时间:2023-12-04 20:53:26 27 4
gpt4 key购买 nike

我希望 GridSplitter 使 TreeView 更大,以便更容易查看 TreeView 的内容。似乎找不到合适的地方放置分路器

<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="auto"/>
<RowDefinition />
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>

<TextBlock Grid.Column="0" Grid.Row="0" Text="JSON String" Margin="5"/>
<TextBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3"/>

<GridSplitter Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2" Height="5" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch"/>

<TextBlock Grid.Column="0" Grid.Row="3" Text="C# Type" Margin="5"/>
<TreeView Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="3" x:Name="outputTree" Margin="5"/>

最佳答案

将其设置为与第二个 TextBlock 相同的行并设置 ResizeBehaviorPreviousAndNext我调整了您的一些行定义,以便根据需要进行调整

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition />
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock Grid.Column="0" Grid.Row="0" Text="JSON String" Margin="5"/>
<TextBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" Margin="5"/>


<GridSplitter Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2" Height="5" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<TextBlock Grid.Column="0" Grid.Row="2" Text="C# Type" Margin="5"/>
<TreeView Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3" x:Name="outputTree" Margin="5"/>
</Grid>

关于wpf - Gridsplitter 不调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36137993/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com