Skip to content

Commit caca5bf

Browse files
authored
Merge pull request #4219 from artemious7/patch-2
Fix code in 'Use NavigationView instead of Pivot'
2 parents 10577b5 + 590928e commit caca5bf

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

hub/apps/design/controls/pivot.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ This XAML creates a NavigationView with 3 sections of content, like the example
7979
<NavigationViewItem Content="Section 2" x:Name="Section2Content" />
8080
<NavigationViewItem Content="Section 3" x:Name="Section3Content" />
8181
</NavigationView.MenuItems>
82+
83+
<Frame x:Name="ContentFrame" />
8284
</NavigationView>
8385

8486
<Page x:Class="AppName.Section1Page">
@@ -99,27 +101,26 @@ NavigationView provides more control over navigation customization and requires
99101
```csharp
100102
private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
101103
{
102-
FrameNavigationOptions navOptions = new FrameNavigationOptions();
103-
navOptions.TransitionInfoOverride = new SlideNavigationTransitionInfo() {
104-
SlideNavigationTransitionDirection=args.RecommendedNavigationTransitionInfo
105-
};
106-
107-
navOptions.IsNavigationStackEnabled = False;
108-
109-
switch (item.Name)
110-
{
111-
case "Section1Content":
112-
ContentFrame.NavigateToType(typeof(Section1Page), null, navOptions);
113-
break;
114-
115-
case "Section2Content":
116-
ContentFrame.NavigateToType(typeof(Section2Page), null, navOptions);
117-
break;
118-
119-
case "Section3Content":
120-
ContentFrame.NavigateToType(typeof(Section3Page), null, navOptions);
121-
break;
122-
}
104+
var navOptions = new FrameNavigationOptions
105+
{
106+
TransitionInfoOverride = args.RecommendedNavigationTransitionInfo,
107+
IsNavigationStackEnabled = false,
108+
};
109+
110+
switch (args.InvokedItemContainer.Name)
111+
{
112+
case nameof(Section1Content):
113+
ContentFrame.NavigateToType(typeof(Section1Page), null, navOptions);
114+
break;
115+
116+
case nameof(Section2Content):
117+
ContentFrame.NavigateToType(typeof(Section2Page), null, navOptions);
118+
break;
119+
120+
case nameof(Section3Content):
121+
ContentFrame.NavigateToType(typeof(Section3Page), null, navOptions);
122+
break;
123+
}
123124
}
124125
```
125126

0 commit comments

Comments
 (0)