![]() Private ShellViewModel ViewModel => DataContext as ShellViewModel public sealed partial class ShellPage : IShellView TODO WTS: Change the icons and titles for all NavigationViewItems in ShellPage.xaml. Changes in C# code you will have to add ( Implementation below): Header and HeaderTemplate properties from NavigationView.Add the winui: namespace to NavigationView and NavigationViewItems data types.Xaml code you will have to update ( Implementation below): Add NavigationViewHeaderBehavior with DefaultHeader and DefaultHeaderTemplate properties to NavigationView behaviors. ![]() Add IsBackButtonVisible and IsBackEnabled properties to NavigationView.i, ic, winui and behaviors namespaces in page declaration.Xaml code you will have to add ( Implementation below): The updated ShellPage will contain a WinUI NavigationView that handles back navigation in the app using the NavigationView's BackButton and the above mentioned bahavior to hide/personalize the NavViewHeader depending on the page shown. Changes in NavHelper.cs and IShellView.csĪdjust using statement to move the NavigationView and NavigationViewItem data types to Windows UI data types. Private INavigationService NavigationService 8. Tasks after activation await StartupAsync() Ensure the current window is active Window. CanHandle( activationArgs))Īwait defaultHandler. Var defaultHandler = new DefaultLaunchActivationHandler( _defaultNavItem, NavigationService) CanHandle( activationArgs)) Īwait activationHandler. Var activationHandler = GetActivationHandlers() Create a Frame to act as the navigation context and navigate to the first page if ( _shell ?. Do not repeat app initialization when the Window already has content, // just ensure that the window is active if ( Window. Initialize things like registering background task before the app is loaded await InitializeAsync() ![]() Public async Task ActivateAsync( object activationArgs) Public ActivationService( WinRTContainer container, Type defaultNavItem, Lazy shell = null) Private readonly WinRTContainer _container For more information on application activation see internal class ActivationService ActivateFromShareTargetAsync will appears in ActivationService only if you have added ShareTarger feature.) (Code in methods: ActivateFromShareTargetAsync, InitializeAsync, StartupAsync and GetActivationHandlers might change depending on the pages/features you used. The resulting code should look like this:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |