Liriann
Liriann

Reputation: 21

How to open in(on) the current window?

I think my question is simple but i can not handle with it.

If i have window and a button on it and i want to open other window control on that window how can i do that? I try do that through the VSM but I jam and still don't know how to do that. Maybe there is a simplier way?

Yes. Thank all of you for answers, but I think i didn't specify clearly what i wanted to get.
Methods: Show() and ShowDialog() opens new windows and i wanted to open controls in current window. I think about something like that:
newWindowControl nwc = new newWindowControl();
LayoutRoot.Children.Add(nwc);

but in VSM.
I don't know if it is possible to do that.

Upvotes: 2

Views: 212

Answers (2)

Eminem
Eminem

Reputation: 7484

private void button1_Click(object sender, EventArgs e)
{
    using (Form2 form2 = new Form2())
    {
        form2.ShowDialog();
    }
}

Upvotes: 0

Haris Hasan
Haris Hasan

Reputation: 30097

If you want to open another window on top of existing window, just like a popup.. You can simply Initialize a new window and call its show method.

//Second window is of type Window
SecondWindow window = new SecondWindow();
window.Show();

Upvotes: 2

Related Questions