_ Windows Store UI.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. The steps to get this Store UI working are:
  2. 1. Add a reference to your Core PCL project
  3. 2. Change App.Xaml.cs so that it creates a 'new Setup(RootFrame)' during its OnLaunched:
  4. protected override void OnLaunched(LaunchActivatedEventArgs args)
  5. {
  6. var rootFrame = Window.Current.Content as Frame;
  7. // Do not repeat app initialization when the Window already has content,
  8. // just ensure that the window is active
  9. if (rootFrame == null)
  10. {
  11. // Create a Frame to act as the navigation context and navigate to the first page
  12. rootFrame = new Frame();
  13. if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
  14. {
  15. //TODO: Load state from previously suspended application
  16. }
  17. // Place the frame in the current Window
  18. Window.Current.Content = rootFrame;
  19. }
  20. if (rootFrame.Content == null)
  21. {
  22. // When the navigation stack isn't restored navigate to the first page,
  23. // configuring the new page by passing required information as a navigation
  24. // parameter
  25. var setup = new Setup(rootFrame);
  26. setup.Initialize();
  27. var start = Cirrious.CrossCore.Mvx.Resolve<Cirrious.MvvmCross.ViewModels.IMvxAppStart>();
  28. start.Start();
  29. }
  30. // Ensure the current window is active
  31. Window.Current.Activate();
  32. }
  33. 3. For Windows 8 - Add a views folder and a view - xaml.cs and .xaml based on BasicPage - this will add 5 files to the Common folder.
  34. - Change the Common/LayoutAwarePage.cs inheritance to Cirrious.MvvmCross.WindowsStore.Views.MvxStorePage
  35. - Change the Common/LayoutAwarePage.cs - remove the OnNavigatedTo and OnNavigatedFrom handlers
  36. - Add some content for your Xaml - e.g. <TextBlock Grid.Row="1" Text="{Binding Hello}" />
  37. 5. For Windows 8.1 - Add a views folder and a view based on the BasicPage template
  38. - In the .xaml.cs - remove public NavigationHelper NavigationHelper and all referencing code
  39. - In the .xaml.cs - remove the OnNavigatedTo and OnNavigatedFrom handlers
  40. - Add some content for your Xaml - e.g. <TextBlock Grid.Row="1" Text="{Binding Hello}" />