0
votes

I create a 4 stackPanel in one DockPanel

Which panel just a frame window

4 StackPanel

then I create a Grid to include the Left StackPanel and Right StackPannel 3 StackPannel

For now I add a button in Bottom Frame, to switch Hide Left and right

and show VCenter Frame or invert. But I no idea to do this feature.

Some suggest for me?

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="PanelUserCtrlSample.MainWindow"
    Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<DockPanel LastChildFill="True">
    <StackPanel DockPanel.Dock="Top" Width="Auto" Height="50" Background="Red">
        <Frame x:Name="frmMainTop" NavigationUIVisibility="Hidden">
        </Frame>
    </StackPanel>
    <StackPanel DockPanel.Dock="Bottom" Width="Auto" Height="50" Background="Blue">
        <Frame x:Name="frmMainBottom" NavigationUIVisibility="Hidden">
        </Frame>
    </StackPanel>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="83*"/>
            <ColumnDefinition Width="434*"/>
        </Grid.ColumnDefinitions>

        <!--Full Screen-->

        <!--<StackPanel  DockPanel.Dock=""  Grid.ColumnSpan="2" Width="Auto" Height="Auto" Background="Black">
            <Frame x:Name="frmMainFull" NavigationUIVisibility="Hidden">

            </Frame>
        </StackPanel>-->

        <!--VCenter-->
        <StackPanel  DockPanel.Dock="Left"  Grid.ColumnSpan="2" Width="Auto" Height="Auto" Background="Black">
            <Frame x:Name="frmMainVCenter" NavigationUIVisibility="Hidden">

            </Frame>
        </StackPanel>

        <!--left-->
        <StackPanel  DockPanel.Dock="Left"  Grid.Column="0" Width="Auto" Height="Auto" Background="Green">
            <Frame x:Name="frmMainLeft" NavigationUIVisibility="Hidden">

            </Frame>
        </StackPanel>

        <!--Right-->
        <StackPanel Grid.Column="1" Background="Pink">
            <Frame x:Name="frmMainRight" NavigationUIVisibility="Hidden">

            </Frame>
        </StackPanel>
    </Grid>
</DockPanel>

MainWindow_Loaded

private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        frmMainTop.NavigationService.Navigate(new PageTop1());
        frmMainLeft.NavigationService.Navigate(new PageLeft1());
        frmMainRight.NavigationService.Navigate(new PageRight1());
        frmMainBottom.NavigationService.Navigate(new PageBottom1());
    }

File list

enter image description here

if I want to Create a Full stackpanel, How do I implement it.

1

1 Answers

0
votes

I get a solution to impletement.

MainWindow rootwindow = (MainWindow)Application.Current.MainWindow;
rootwindow.spMainLeft.Visibility = Visibility.Hidden;
rootwindow.spMainRight.Visibility = Visibility.Hidden
rootwindow.pageBottom.lblBottom.Content = "Change";