GridSplitter会导致ContentController的高度发生变化吗?

时间:2017-06-08 02:35:49

标签: c# wpf grid gridsplitter

当我开始使用GridSplitter更改网格的高度时,GridSplitter下面Grid内的ContentController的高度开始引起问题。

很抱歉,如果我的问题不明确。参考我的图像更容易看到问题。谢谢您的帮助。

初始图片

Image when GridSplitter has not been started

第二张图片

Image when GridSpliter has started to be used

正如您在gridSplitter下面看到的那样,内容已被扭曲。

当我同时使用网格索引' 0'和网格索引' 2'行高为AUTO - 这里的问题是我不能设置底部网格的最小高度

Both row is set to AUTO

此部分的代码。 P / S,内容控制器将切换userControl,userControl高度和宽度已设置为AUTO。

<Grid Grid.Column="1" Background="Black">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="auto" MinHeight="180"/>
                </Grid.RowDefinitions>
                <Grid Name="gridListboxAndButton">
                    <ListBox
                        ScrollViewer.VerticalScrollBarVisibility="Hidden"
                        Width="0"
                        BorderThickness="0"
                        Name="designControlListBox" 
                        Background="Black"
                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                        Padding="0,10px,0,5px"
                        ItemTemplate="{StaticResource keyDesignTemplateFromResources}">
                    </ListBox>
                    <Button
                        Name="btnSaveDesign"
                        Style="{StaticResource saveButtonStyle}"
                        Width="0"
                        Margin="0,0,0,10"
                        Height="40"
                        Content="{StaticResource buttonSaveContent}" 
                        VerticalAlignment="Bottom" 
                        Click="btnSaveDesign_Click">
                    </Button>
                </Grid>
                <GridSplitter Grid.Row="1" 
                              Height="5" 
                              HorizontalAlignment="Stretch"/>
                <Grid Grid.Row="2" Name="gridDesignToolboxProperties" 
                      Background="Black" 
                      Width="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock
                        Padding="0,10,0,0"
                        Background="Transparent"
                        Foreground="White"
                        Text="PROPERTIES"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        Grid.Column="0"
                        Grid.Row="0">
                    </TextBlock>
                    <TextBlock
                        Padding="0,10,0,0"
                        Background="Transparent"
                        Foreground="White"
                        Text="VALUE"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        Grid.Column="1"
                        Grid.Row="0">
                    </TextBlock>
                    <ContentControl Grid.Row="1"
                        Grid.ColumnSpan="2" 
                        Name="contentSection" 
                        Background="Black" />
                </Grid>
            </Grid>

0 个答案:

没有答案