简体   繁体   中英

C# - Navigate to a XAML page inside a folder

I am an UWP app, and I want organize my code and all my files (XAML and C# files of my app). Can I put XAML files inside a folder? If yes, I use this to navigate to another XAML page: this.Frame.Navigate(typeof(XamlPage)); And if I put the XAML file inside a folder, how can I solve this?

Something like this? this.Frame.Navigate(typeof(FolderName.XamlPage));

When you create a page inside a new folder, it will be inside a namespace of the same name. So supposing your app is called MyApp and your folder is FolderName , the namespace is MyApp.FolderName .

You can then put a using statement on top of the page:

using MyApp.FolderName;

And then you can normally navigate:

Frame.Navigate(typeof(XamlPage));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM