views:

271

answers:

1

I was wondering if anyone knew of a way to mimic the ".show();" method silverlight 4?

Basically I have a form that includes a button. When that button is clicked, I would like the program to bring up another form that I have created. So essentially, in Page1.cs I have:

private void btn_Button1_Click(object sender, RoutedEventArgs e)
{
    Page2 np = new Page2();
}

In a winForms application programming in C#, I would then add "np.Show();" beneath the codeline "Page2 np = new Page2();" to bring up Page2 in a new window. However, it won't let me add the ".show();" to "np".

So I was wondering if there was possibly a Using directive I might be missing somewhere or if anyone knew of a silverlight equivalent to the winforms ".show()" method or even if there is a better way to accomplish the task of opening Page2 on the button click in Page1.

Thank you!

+2  A: 

I'm not sure if this is what you want, but you could use a ChildWindow

Assuming Page is a Control of some type you could

ChildWindow popup = new ChildWindow
{
    Title="Page2",
    Content = new Page(),
};

popup.Show();

Here's some more information about ChildWindows, This will pop up a pseudo window in the browser in a modal mode.

luke
Yes, this should do the trick. Thank you, sir, and have a wonderful day!
AmbiguousX