Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How to switch userControls in code?
3 replies. Latest Post by CraigN on March 11, 2008.
(0)
Kostja
Member
38 points
16 Posts
03-11-2008 10:15 AM |
Hello
I have 2 user controls in my project : 1- authentification form - AuthForm and 2 - ChatForm
AuthForm user control has event UserAuthentificated.
How can i switch between these controls in code? I mean when user is authetificated then AuthForm control shold be replaced byChatForm
public
{
InitializeComponent();
}
It doesn`t work
pbrooks
Contributor
2671 points
355 Posts
03-11-2008 12:15 PM |
Kostja,
You could create a container control as your RootVisual and then let the container control orchestrate the display of the authentication and chat forms.
CraigN
352 points
89 Posts
03-11-2008 3:45 PM |
I tried this out and looked at the source for the RootVisual property. It goes off into some unmanaged code. I have however found a post from Pete Brown explaining it.
I suppose the general way you would have to do this would be to make some form of UserControl container class as was suggested above. I'm seeing if I can mock you one up quickly. If you beat me to it, post it here.
03-11-2008 4:28 PM |
I decided to post the solution on my blog over here. Hope it helps you out.