@@ -79,6 +79,8 @@ This XAML creates a NavigationView with 3 sections of content, like the example
79
79
<NavigationViewItem Content =" Section 2" x : Name =" Section2Content" />
80
80
<NavigationViewItem Content =" Section 3" x : Name =" Section3Content" />
81
81
</NavigationView .MenuItems>
82
+
83
+ <Frame x : Name =" ContentFrame" />
82
84
</NavigationView >
83
85
84
86
<Page x : Class =" AppName.Section1Page" >
@@ -99,27 +101,26 @@ NavigationView provides more control over navigation customization and requires
99
101
``` csharp
100
102
private void NavView_ItemInvoked (NavigationView sender , NavigationViewItemInvokedEventArgs args )
101
103
{
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
+ }
123
124
}
124
125
```
125
126
0 commit comments