如何在网格中调整大小时修复最后一列自动隐藏

时间:2019-04-19 13:49:24

标签: c# wpf gridsplitter

这是我的密码

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="{Binding TitleHeight, FallbackValue=40}" />
        <RowDefinition Height="{Binding TitleHeight, FallbackValue=40}"/>
        <RowDefinition Height="1"/>
        <RowDefinition />
    </Grid.RowDefinitions>
    <!-- Title Bar-->
    <DockPanel Grid.Row="0" Background="{StaticResource BlackBackground}">
        <StackPanel VerticalAlignment="Center">
            <ContentControl prism:RegionManager.RegionName="LogoButtonRegion" />
        </StackPanel>
        <StackPanel >
            <ContentControl prism:RegionManager.RegionName="MenuRegion"/>
        </StackPanel>
        <StackPanel >
            <ContentControl prism:RegionManager.RegionName="WindowControlRegion" />
        </StackPanel>
    </DockPanel>
    <!-- Tool Bar -->
    <StackPanel Grid.Row="1" Background="{StaticResource DarkBackGround}"/>
    <!-- Splitter For ToolBar and Main Region -->
    <Border Height="0.8"
            SnapsToDevicePixels="True"
            HorizontalAlignment="Stretch"
            Background="{StaticResource BlackBackground}"
            Grid.Row="2"/>
    <!-- Program Region -->
    <Grid Grid.Row="3">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" MinWidth="40" MaxWidth="150"/> <!-- Left Panel -->
            <ColumnDefinition Width="1"/> 
            <ColumnDefinition Width="150"/> <!-- Quick Tool Panel -->
            <ColumnDefinition Width="1"/>
            <ColumnDefinition MinWidth="30"/> <!-- Main Content -->
            <ColumnDefinition Width="1"/>
            <ColumnDefinition Width="40"/> <!-- Properties Content -->
            <ColumnDefinition Width="1"/>
            <ColumnDefinition Width="40" MinWidth="40"/> <!-- Right Panel -->
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="40"/>
            <RowDefinition Height="1"/>
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <!-- Left Panel -->
        <materialDesign:ColorZone Mode="Accent"
                                  VerticalAlignment="Stretch"
                                  Grid.Column="0">
        </materialDesign:ColorZone>
        <GridSplitter ResizeDirection="Columns" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" Style="{StaticResource GenegicGridSplitter}"/>
        <!-- Quick Tool Panel -->
        <Grid Grid.Row="0" Column="2" Background="{StaticResource DarkBackGround}"></Grid>
        <GridSplitter ResizeDirection="Columns" Grid.Row="0" Grid.Column="3" Style="{StaticResource GenegicGridSplitter}"/>
        <!-- Main Content -->
        <Grid Grid.Row="0" Grid.Column="4"></Grid>
        <GridSplitter ResizeDirection="Columns" Grid.Row="0" Grid.Column="5" Grid.RowSpan="3" Style="{StaticResource GenegicGridSplitter}" Panel.ZIndex="1" />
        <!-- Properties Content -->
        <Grid Grid.Row="0" Grid.Column="6" Grid.RowSpan="3" Background="{StaticResource DarkBackGround}"></Grid>
        <Border Grid.Row="0" Grid.Column="7" Grid.RowSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource BlackBackground}"/>
        <!-- Right Panel -->
        <Grid Grid.Row="0" Grid.Column="8" Grid.RowSpan="3" Background="{StaticResource DarkBackGround}">
            <StackPanel>
                <Button Content="Test"></Button>
            </StackPanel>
        </Grid>
        <GridSplitter ResizeDirection="Rows" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="6" Style="{StaticResource GenegicGridSplitter}"/>
        <!-- Bottom Panel -->
        <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="6" Background="{StaticResource DarkBackGround}">
            <StackPanel>
                <Button Content="Test"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Grid>

我的问题是当我调整主要内容列和属性内容列的大小时。如果主要内容列即将达到最小宽度,则最后一列将自动隐藏,我不希望发生这种情况,请解决此问题的任何解决方案。

这是一个示例:  enter image description here

这就是我想要的。 enter image description here

0 个答案:

没有答案