c# - Change the Location of DefaultPage in Universal App -
how can change location of default mainpage.xaml in universal windows app? want have in windows , windowsphone project subfolder named "view" save mainpage.xaml file example.
- windows project
-- view
--- mainpage.xaml
- windowsphone project
-- view
--- mainpagephone.xaml
- shared files
-- model
-- viewmodel
-- app.xaml
with structure have problem in app.xaml.cs mainpage can't find.
if (!rootframe.navigate(typeof(mainpage), e.arguments)) { throw new exception("failed create initial page"); }
first, don't need give different names files, use mainpage both phone , pc project , put mainpage.xaml inside view folder. universal app aware of platforms runs on , load right page accordingly. need create view folder , mainpage.xaml file in both projects. delete every mainpage.xaml files outside of view folder.
then navigate app.xaml.cs shared file.
look onlaunched method, should find @ end of method:
if (!rootframe.navigate(typeof(mainpage), e.arguments)) { throw new exception("failed create initial page"); } this project try load page. mainpage should marked error because we're missing reference.
so, add @ top of app.xaml.cs page:
using nameofyourprojecthere.view; let me know if works!
Comments
Post a Comment