Hi,
Below is an example of my code for Sidebar navigation:
<App Theme="Basic">
<DockPanel ux:Class="SidebarWithNavigate">
<Page ux:InnerClass="PageWithTitle1" ux:Name="self" HitTestMode="LocalBoundsAndChildren">
<float4 ux:Property="HeaderColor" />
<float4 ux:Property="HeaderTextColor" />
<ExitingAnimation>
<Move X="-1" RelativeTo="Size" />
</ExitingAnimation>
<StackPanel Dock="Top">
<StatusBarBackground />
<Panel Color="{Property self.HeaderColor}" Height="45">
<Button Alignment="Left" Text="Sidebar">
<Clicked>
<Set navEdge.Active="sideMenu" />
</Clicked>
</Button>
<Text Value="{Property self.Title}" FontSize="22" Alignment="Center" TextColor="{Property self.HeaderTextColor}"/>
</Panel>
</StackPanel>
</Page>
<EdgeNavigator ux:Name="navEdge" HitTestMode="LocalBoundsAndChildren">
<StackPanel ux:Name="sideMenu" Width="150" EdgeNavigation.Edge="Left" Background="#f63">
<Button Text="Basic Animation">
<Clicked>
<NavigateTo Target="pageBasicAnim" />
<NavigateTo Target="pageBasicAnim" NavigationContext="navMain" />
</Clicked>
</Button>
<Button Text="Logic with JavaScript">
<Clicked>
<NavigateTo Target="pageJsLogic" />
<NavigateTo Target="pageJsLogic" NavigationContext="navMain" />
</Clicked>
</Button>
<Button Text="Realtime effects">
<Clicked>
<NavigateTo Target="pageEffects" />
<NavigateTo Target="pageEffects" NavigationContext="navMain" />
</Clicked>
</Button>
</StackPanel>
<Panel>
<DirectNavigation ux:Name="navMain" Active="pageBasicAnim"/>
<PageWithTitle1 ux:Name="pageBasicAnim" Title="Basic animation" HeaderColor="#595FFF" HeaderTextColor="#fff" />
<PageWithTitle1 ux:Name="pageJsLogic" Title="Logic with JavaScript" HeaderColor="#F68FD7" HeaderTextColor="#FFF" />
<PageWithTitle1 ux:Name="pageEffects" Title="Realtime effects" HeaderColor="#2CAE3F" HeaderTextColor="#fff" />
</Panel>
</EdgeNavigator>
</DockPanel>
</App>
The menu button Clicked handlers call NavigateTo two times. Since:
- If I just call
<NavigateTo Target="pageBasicAnim" />
then the page navigation doesn’t occur but the sidebar collapses. - If I just call
<NavigateTo Target="pageBasicAnim" NavigationContext="navMain" />
then the page navigation occurs but the sidebar doesn’t collapse. - If I call both of them then the page navigation occurs and also the sidebar collapses.
Is this normal or calling <NavigateTo Target="pageBasicAnim" NavigationContext="navMain" />
should both navigate to page and collapse the sidebar?
Thanks in advance,
Ipek