switching xaml pages in a wpf application
I was just wondering how to go about switching xaml "pages" in an application. I google, and google, and google, but I either cant figure out what the people are talking about, or it is for silverlight or what ever.
Basically what I want is an application, which has a main window in it, and when A user clicks a link (home for example), the inside of the window displays the开发者_如何学Python home screen. Then the user clicks the login link, and the login screen appears.
I assume that I will need to use c# to do this (which is ok, I am used to using c#, I am just using xaml so that I have more control over what my forms look like). Some of the solutions I have read, seem to be doing wierd stuff in xaml that I really dont understand...
From what I have read, some people say to use windows, some say to use pages...which do you recommend for someone just starting to learn xaml.
I use expression blend, and visual studio 2010 to do this work.
I am new to Xaml, but have lots of experience with C#.
Thanks
I would recommend looking into the MVVM design pattern for WPF and using that.
You would have something like a ShellViewModel
which contains your application shell. This contains a CurrentPage
property, which is the ViewModel of whatever page is current. When someone clicks a link, the CurrentPage
property gets updated to whatever ViewModel should be displayed.
I actually wrote something about it here if you're interested
精彩评论