views:

141

answers:

1

I am new to WPF and am trying to find the right control.

I am coding a WPF app that has two sections. The left side is an Outlook like sidebar (Odyssey controls).

For everything else I want a control that I can easily swap the contents of based on what is in the side bar.

So the user selects an option in the side bar and all the controls in the main section would change.

If I was writing this in Windows Forms I could just create a few Panels and then show the one that is relevant (and hide the others). When I try this in WPF you can see the contents of the panel underneath. I know I could make them not visible, but I am getting the feeling that I may be going about this the wrong way.

So here is the question. What is the best way (in WPF) to handle content sections of the app to change.

+1  A: 

Based on your example (switching what is shown based on what is selected in a side panel) I'd recommend restyling a TabControl because that's really tab switching even if it doesn't look like it. Check out this for a decent example, set TabStripPlacement to Left and you will have a good start.

Depending on how your data is set up a Master-Detail pattern might be another good choice.

If you want to switch everything programmatically you'll want to use a ContentPresenter and DataTemplates for the UI "panels". This article by Josh Smith is about MVVM but his example application is basically the pattern you'll be looking for.

Bryan Anderson
Problem with a TabControl is that the UI allows the user to switch between panels. I need this to be controlled programmatically and not even show up in the UI.
Vaccano
Sorry, from "So the user selects an option in the side bar and all the controls in the main section would change." I thought it was the user controlling the changed. If it's being changed programmatically see my addition.
Bryan Anderson