Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

One WPF Window/View Controller with multiple views

Posted on 2012-08-16
3
Medium Priority
?
1,989 Views
Last Modified: 2012-08-25
In a WPF window I will have buttons on the top and then content below.

In the content section (buttons always stay there) I want to have maybe a "view" with some text boxes and then some other "view" with a datagrid.  These "views" I want to have their own code behind class.

On the click of a button I want to be able to add the new "view" and maybe animate a little bit the removal of the old "view"

Dont get to caught up in the animate part.

The thing I want to know is what is the Object/element which can contain these multiple views?
How can I create my "views" with code behind?
How can I add then a new view and dispose of the old view so that views are not kept in memory?

I am a VB'er but if you must do it in C# then go for it.

Thanks all for your help.
0
Comment
Question by:darbid73
  • 2
3 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 38306430
Hope below link helps. You can have Grid with two rows, first row has your buttons and second row has ur Frame control instead of Dockpanel

http://www.paulstovell.com/wpf-navigation
0
 
LVL 20

Accepted Solution

by:
darbid73 earned 0 total points
ID: 38312213
What I am looking for has not much to do with "navigation" such as what Internet Explorer does.  As such navigation might be a bad word to use.

Basically I am looking for a beginner's answer.

The thing I want to know is what is the Object/element which can contain these multiple views?
Basically any of the WPF objects that can have 1 to n children will work.  Eg a Grid.
How can I create my "views" with code behind?
Create a UserControl and add whatever objects you want to this.  Use the generated Code behind file for this User Control.
How can I add then a new view and dispose of the old view so that views are not kept in memory?
 This UserControl can then be added and removed from for example a Grid by simply adding a child and then removing an old child.
0
 
LVL 20

Author Closing Comment

by:darbid73
ID: 38332097
I think this is the best solution to my question.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question