How do you put XAML page on another XAML page?



  • There are 3 pages. MainPage.xaml, AboutPage.xaml, SettingsPage.xaml. введите сюда описание изображения

    There is also SplitView in a separate page with buttons to 3rd pages. That's the problem. I can make three separate SplitView to each page, but when SplitView is open on one of the pages, when another SPlitView is pressed on the button. введите сюда описание изображения введите сюда описание изображения This is where I was first on MainPage and pressed SettingsPage, but SplitView closed. I decided to make one SplitView on all the pages, but I don't know how to download it. SplitView.

     <SplitView x:Name="MySplitView" DisplayMode="CompactOverlay" 
                   CompactPaneLength="50" OpenPaneLength="150" Margin="0,0,1130,-230">
                <SplitView.Pane>
                    <StackPanel Padding="0" Margin="0" Background="#FF2196F3">
                        <Button x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content="&#xE700;"
                            Width="50" Height="50" Background="Transparent"  FontSize="32" Margin="0,0,0,80" Tapped="HamburgerButton_Click"/>
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
                            <Button x:Name="MainPageButton" FontFamily="Segoe MDL2 Assets" Content="&#xE10F;"
                                Width="50" Height="50" Background="Transparent" FontSize="26.667" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center"  Tapped="MainPageButton_Click"/>
                            <TextBlock Text="Home" FontSize="18" VerticalAlignment="Center" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
                            <Button x:Name="SettingsPageButton" FontFamily="Segoe MDL2 Assets" Content="&#xE713;"
                                Width="50" Height="50" Background="Transparent" FontSize="26.667" Tapped="SettingsPageButton_Click" />
                            <TextBlock Text="Settings" FontSize="18" VerticalAlignment="Center" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="0">
                            <Button x:Name="AboutPage" FontFamily="Segoe MDL2 Assets" Content="&#xE897;"
                                Width="50" Height="50" Background="Transparent" FontSize="26.667" Tapped="AboutPage_Click"/>
                            <TextBlock Text="About" FontSize="18" VerticalAlignment="Center" />
                        </StackPanel>
                    </StackPanel>
                </SplitView.Pane>
            </SplitView> 
    

    In a separate page of SplitView.xaml, the code is the same as the matching functions in SplitView.xaml.cs



  • I'd do the following.

    MainPage, AboutPage and SettingsPage would not make pages, but UserControl's. There would be one root page in which SplitView would lie, and in his right part. Grid c MainPage, AboutPage and SettingsPage, of which two would cover with triggers.

    This is a fairly typical decision for at least WPF. Maybe there's something more idiomal for UWP.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2