Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF application (not browser) and navigation

Tags:

c#

wpf

I want to develop a desktop application based on WPF. How do I navigate via C# code from one page to another or from one page in a window?

like image 708
Frank Avatar asked Mar 01 '13 11:03

Frank


People also ask

How do I navigate in WPF application?

To package content for navigation, WPF provides the Page class. You can navigate from one Page to another declaratively, by using a Hyperlink, or programmatically, by using the NavigationService. WPF uses the journal to remember pages that have been navigated from and to navigate back to them.

Can WPF application run in browser?

WPF Browser applications (or XAML Browser applications, or XBAP) are a specific kind of application that are compiled into . xbap extensions and can be run in Internet Explorer.

What is frame in WPF?

The WPF Frame control using XAML and C# supports content navigation within content. A Frame can be hosted within a Window, NavigationWindow, Page, UserControl, or a FlowDocument control.

How do I open a new window in WPF?

You will need to create an instance of a new window like so. var window2 = new Window2(); Once you have the instance you can use the Show() or ShowDialog() method depending on what you want to do. var result = window2.


2 Answers

Take a look at the following links below - these will give you a better understanding of navigating through a WPF application providing examples and sample apps.

How to Build, Manage and Navigate the User Interface of a WPF Application

Simple Navigation

More advanced Navigation

A really easy way to navigate through an application I find is that if you add a Frame within a Window and then for your other corresponding pages, use Page and you need to do in the code behind of your window is as follows;

FrameContent.Navigate(new ExampleView());

Hope these links help!

like image 78
greg Avatar answered Oct 03 '22 05:10

greg


There is simple example of navigation by using Data Templates and ContentControl

like image 25
Pylyp Lebediev Avatar answered Oct 03 '22 07:10

Pylyp Lebediev