tags:

views:

55

answers:

2

i am trying to create a wpf app and have different parts in user controls.

in the navigation i have some buttons (now using the ribbon ctp). is it possible to change the main user control when different buttons are pressed in xaml. or is this just a bad way to do things?

sorry, really new to xaml and im trying to get my head arround it.

+1  A: 

I think this is a pretty regular procedure in WPF. In my experience, me and other programmers put the controls where we want to show them and make their visibility hidden, collapsed or visible depending on what we want to show the user.

Carlo
do you do this in code or just using xaml?
aaron
We usually do it in code.
Carlo
+2  A: 

Further to what Carlo has said,

The way we do it is to have a blank grid in the place you want your controls to all appear and then use BlankGrid.Children.Clear() and BlankGrid.Children.Add() to set up which control is visible in this position.

We found that was the nicest programatically as we have a large number of custom controls, but Carlo's method would work nicely if you wanted to use the designer.

Tim Joseph
picked this one because it seems more natural to me
aaron
Yeah this is a good idea too. We've done it this way because we only use at most 3 different controls to show / hide; but I guess if there's a lot of them, this is a better approach.
Carlo
i think my biggest problem is that along with learning wpf i am trying to get on the mvvm bandwagon. and mvvm seems to say all code goes in the viewmodel
aaron