J_PT
J_PT

Reputation: 489

UWP Using Pages from different Project

Is it possible to have all pages in a different project from where the app.xaml/cs is in?

I tested this by creating a new "Class Library (Universal Windows)" or "Windows Runtime Component" project, then I created the new pages in those projects.

After I add this project as a reference to the main UWP app and call the page(s) in the "rootFrame.Navigate(typeof(MainShellView), e.Arguments)" I get the exception

system.accessviolationexception attempted to read or write protected memory

Is it possible to have the pages, controls in different projects than the UWP main project and use them as references?

Upvotes: 3

Views: 190

Answers (1)

Stefan Wick  MSFT
Stefan Wick MSFT

Reputation: 13850

You will need to keep an empty/dummy MainPage.xaml page in the main project as there is a hard-coded reference to it in the project system. With that in place you can load all your pages (incl. the initial start page) from other projects that you are referencing in the solution.

I will log a bug on the hard-coded dependency on the existence of "MainPage.xaml". Thanks for reporting!

Upvotes: 4

Related Questions