DESIGNING .NET 4
WINDOWS APPLICATIONS:
PRESENTATION LAYER

- WPF NAVIGATION

APPLICATIONS

<Frame Margin="66,98,12,64" Name="navFrame" Source="Page2.xaml" />

<TextBlock>This is a

<Hyperlink NavigateUri="http://www.microsoft.com">hyperlink</Hyperlink>

</TextBlock>

<TextBlock>This is a <Hyperlink Name="myLink">hyperlink</Hyperlink></TextBlock>

myLink.NavigateUri = new System.Uri("Page2.xaml", System.UriKind.Relative);

<TextBlock>This is a <Hyperlink NavigateUri="Page2.xaml">hyperlink</Hyperlink>

</TextBlock>

public void HandleNavigated(object sender,

System.Windows.Navigation.NavigationEventArgs e)
{

// Event handling code.

}

public void HookupeventHandler()

{

NavigationService.Navigated += HandleNavigated;

}

NavigationService.Navigate(New System.Uri("page2.xaml"), "user = Joe");

public void HandleNavigate(object sender,

System.Windows.Navigation.NavigationEventArgs e)
{

if (e.ExtraData.ToString() == "user=Kilroy")

{

Trace.WriteLine("Kilroy was here.");

}

}

x:TypeArguments="sys:[[DATA TYPE]]"

x:TypeArguments="sys:String"

public partial class PageFunction1 : PageFunction<string>

public void ReturnHandler(object sender,

ReturnEventArgs<string> e)
{

Trace.WriteLine(e.Result);

}

public void GoToPageFunction()

{

PageFunction1 pageFunction = new PageFunction1();

pageFunction.Return += ReturnHandler;

}

OnReturn(new ReturnEventArgs<string>("Kilroy was here"));

NavigationService navService =

NavigationService.GetNavigationService(this);

navService.Navigate(new System.Uri("Page2.xaml", UriKind.Relative));

Page2 page2 = new Page2();

navService.Navigate(page2);

if (navService.CanGoBack)
{

navService.GoBack();

}

while (navService.CanGoBack)
{

navService.RemoveBackEntry();

}

SIMPLE AND STRUCTURED

NAVIGATION

Page-based Applications