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.
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.
Silverlight is a navigation based framework. So it does not enable you to open multiple windows the way you have done with win forms.
精彩评论