0

I have created page1 with hamburger menu in Universal Windows App. I would like to open a page2 in new screen instead of showing the page2 in page1.

Here is my xaml:

<Page x:Class="Hamburger_Menu.MainPage"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="using:Hamburger_Menu"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:triggers="using:WindowsStateTriggers"
          mc:Ignorable="d"
          DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=MainViewModel}">

        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup>
                    <VisualState>
                        <VisualState.StateTriggers>
                            <AdaptiveTrigger MinWindowWidth="1300" />
                        </VisualState.StateTriggers>
                        <VisualState.Setters>
                            <Setter Target="NavigationPane.DisplayMode"
                                    Value="CompactOverlay" />
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState>
                        <VisualState.StateTriggers>
                            <AdaptiveTrigger MinWindowWidth="720" />
                        </VisualState.StateTriggers>
                        <VisualState.Setters>
                            <Setter Target="NavigationPane.DisplayMode"
                                    Value="CompactOverlay" />
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState>
                        <VisualState.StateTriggers>
                            <AdaptiveTrigger MinWindowWidth="0" />
                        </VisualState.StateTriggers>
                        <VisualState.Setters>
                            <Setter Target="NavigationPane.DisplayMode"
                                    Value="Overlay" />
                        </VisualState.Setters>
                    </VisualState>
                    <VisualState>
                        <VisualState.StateTriggers>
                            <triggers:DeviceFamilyStateTrigger DeviceFamily="Mobile" />
                        </VisualState.StateTriggers>
                        <VisualState.Setters>
                            <Setter Target="NavigationPane.DisplayMode"
                                    Value="Overlay" />
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>

            <Grid.RowDefinitions>
                <RowDefinition Height="48" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <ToggleButton x:Name="TogglePaneButton"
                              TabIndex="1"
                              Background="#990000"
                              Style="{StaticResource SplitViewTogglePaneButtonStyle}"
                              IsChecked="{Binding IsPaneOpen, ElementName=NavigationPane, Mode=TwoWay}"
                              AutomationProperties.Name="Menu"
                              ToolTipService.ToolTip="Menu" />

                <Grid Grid.Column="1"
                      Background="#990000">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock FontSize="20"
                               Margin="10,11,0,10"
                               Foreground="White"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left"
                               Text="{Binding SelectedMenuItem.Title}" Grid.RowSpan="2" />
                </Grid>

            </Grid>

            <SplitView x:Name="NavigationPane"
                       Grid.Row="1"
                       OpenPaneLength="215"
                       CompactPaneLength="48"
                       DisplayMode="Inline"
                       IsPaneOpen="False">
                <SplitView.Pane>

                    <ListView x:Name="LeftMenu"
                              Grid.Row="1"
                              Background="{StaticResource MenuBGColorBrush}"
                              ItemContainerStyle="{StaticResource MenuListViewItem}"
                              ItemsSource="{Binding MenuItems}"
                              SelectedItem="{Binding SelectedMenuItem,Mode=TwoWay}">

                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid x:Name="MenuGrid"
                                      Margin="0"
                                      Tapped="MenuGrid_Tapped"
                                      Background="Transparent">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="48" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid Grid.Row="0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="48" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>

                                        <SymbolIcon Symbol="{Binding SymbolIcon}"
                                                    Grid.Column="0"
                                                    VerticalAlignment="Center"
                                                    HorizontalAlignment="Center"
                                                    ToolTipService.ToolTip="{Binding Title}" />

                                        <TextBlock Grid.Column="1"
                                                   VerticalAlignment="Center"
                                                   Text="{Binding Title}"
                                                   Margin="10,0,0,0"
                                                   FontSize="16"
                                                   TextTrimming="CharacterEllipsis" />

                                    </Grid>

                                    <Border Grid.Row="1"
                                            BorderBrush="#33415B"
                                            Height="2"
                                            Margin="0"
                                            VerticalAlignment="Bottom"
                                            BorderThickness="0,0,0,1" />
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>

                </SplitView.Pane>
                <SplitView.Content>

                    <Frame x:Name="FrameContent">
                        <Frame.ContentTransitions>
                            <TransitionCollection>
                                <NavigationThemeTransition>
                                    <NavigationThemeTransition.DefaultNavigationTransitionInfo>
                                        <EntranceNavigationTransitionInfo />
                                    </NavigationThemeTransition.DefaultNavigationTransitionInfo>
                                </NavigationThemeTransition>
                            </TransitionCollection>
                        </Frame.ContentTransitions>
                    </Frame>

                </SplitView.Content>
            </SplitView>
        </Grid>
    </Page>

Screen1: enter image description here

screen2:enter image description here

screen3:enter image description here

When i tab the get quotes button from Page1, I want open a page2 in new screen as a 3rd screen but page2 is displayed on Page1 as screen2 (i.e) page2 is display inside the page1 only.

I used the following code to navigate to the page3 from page1,

this.Frame.Navigate(typeof(GetQuotes));

Advance thanks for reply.

Ram Chandran
  • 83
  • 1
  • 8
  • I cannot properly understand you question, but I think you probably want to use `FrameContent.Navigate(typeof(GetQuotes))` instead of `this.Frame.Navigate(typeof(GetQuotes));` if you invoke this line from your main page ( the page containing the splitview ). – ravi kumar Jul 03 '17 at 15:41
  • Do you want to show your hamburger button in your new page or not ? – ravi kumar Jul 04 '17 at 04:53
  • yes, no need to display – Ram Chandran Jul 04 '17 at 05:59
  • if you are calling `this.Frame.Navigate(typeof(GetQuotes));` from your MainPage then your code seems correct, can you set up a minimal demo project and share it here. – ravi kumar Jul 04 '17 at 06:26
  • Thanks for your reply buddy. I did a mistake in getting the frame, instead of getting the main frame to navigate, i did get the frame of inside frame. Now, it has been solved. – Ram Chandran Jul 04 '17 at 06:42

0 Answers0