WpfNavigation1 ( WPF )

Objectives:

  • The MainWindow is Base-Platform, preferred to be managed with App.xaml (Mark-up) and App.xaml.cs (The code behind)

 

 

 

  • Windows Platform is different than Internet Platform and accordingly many alterations are in place to handle the requirements of each platform
    • In window we can load other windows, where a MainWindow will stand as an entry point to create and view other windows-application-page.
    • Where as the Navigational Pages are best suited for the internet, and the Pages are standalone and free 
  • In WPF-Frame work, MainWindow is the Mother window, you may add more windows pages and these pages can be displayed using Windows events. ( see these examples WpfBaseApp3.htmWpfBaseApp4.htm )

We would try to understand the layouts of WPF applications. The MainWindow ( .Net 4.0) or Window1( in  .Net 3.5) inherits "System.Windows.Window" class.

Let us Look at the properties of one of the typical WPF application we created elsewhere

The illustration below, clearly shows that App object of Application class is engaged in a key role of Initiating components of the WPF application Type like MainWindow/Window1 (in .Net 4.0) and Window1 (in .Net 3.5).  

In the current example "WpfNavigation1", we removed "App.xaml" and created out own Application class that will provide an entry point of this application and manage it's component.

Dispatcher Object : http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx

Navigation Applications

Navigation applications are applications that are composed of many "pages", and often feel similar to web applications, although not always. A navigation application usually provides some kind of shell in which the pages are hosted, with custom chrome or widgets around it.

The pages of a navigation application can usually be broken down into two categories:

  1. Standalone, free pages.
  2. Pages that make up a step in a process.

For example, an online banking application may have a number of standalone pages, such as:

  • The Welcome page
  • The Account Balance page
  • The Help page

These pages are often read-only, or can be navigated to at any time, and don't really form part of a single "task" that the user performs.

Then there are many tasks the user can perform:

  • Applying for a credit card
  • Paying a bill
  • Requesting to increase their transaction limits

Note that these tasks may comprise of subtasks, which can make our navigation model rather complex. Let's dissect each of these sections and discuss how WPF handles them.

 

Step:1 Create a New project

Step:2  Add Window1.xaml

Step:3 What is the Difference ? Not visual but there are some differences, one of them is show below.

Step:4  Now Add a Page.xmal file

Step:5 Now Remove App.xaml

Step:6 Edit Code in Main.xaml.cs and Code in Window1.xaml.cs

Step:6 Edit Code in Window1.xaml and code behind

Step:6 Runtime Views

a) Loading Window1

Window will show all the HTML markups, but won't load the pages .

b) Test with Page1.xaml