Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in xaml, is it bad practice to use a frame, inside a window to display pages?

Tags:

window

xaml

frame

I was just wondering what the common practice is, to have pages (I dont mean pages as in XAML pages, I just mean...different screens) which can be navigated between?

Right now I am using just a bunch of pages, and using the NavigationService class in C# to navigate between my pages. But I just discovered Frames.

Is it better to have a frame inside a window:

<window>
    <frame source="page.xaml" />
</window>

or just do it with all the different pages and the NavigationServices? Or should I be using a window inside the frame?

What do you do??

Thanks!

like image 482
Toadums Avatar asked Jul 06 '11 18:07

Toadums


1 Answers

Frames are commonly used when building a navigation based application in WPF. However, there's a lot to learn about the WPF navigation system and a few things you need to know about the page life cycle, etc. to avoid memory leaks and unexpected behavior.

This is a great overview by Paul Stovell: http://www.paulstovell.com/wpf-navigation

like image 68
sellmeadog Avatar answered Oct 24 '22 20:10

sellmeadog