M.Azad
M.Azad

Reputation: 3763

How to show a child window on its parent?

I have a simple sample;I have 2 window in may sample such as ParentWin & ChildWin In my ParentWin i have a button like this

<Button Name="button1" Width="75" Click="button1_Click" />
   private void button1_Click(object sender, RoutedEventArgs e)
    {
        ChildWin childwindow = new ChildWin();
        ChildWin .ShowInTaskbar = false;
        childwindow.ShowDialog();
    }

When my ChildWin Is in ShowDialog mod if I select ParentWin it actived and my ChildWin Hide. I want that when I select ParentWin from TaskBar my ChildWin does not Hide like a MessageBox Dialog;

Upvotes: 0

Views: 6026

Answers (2)

user3770833
user3770833

Reputation: 209

I knlow this is too late but may help someone else . . .

There is simple way to show a window on parent window in .net:

Just select child window form >

go to property window

and turn "Topmost" property to true. now this window will appear on top of all other windows . .that's all . . ..

Upvotes: 2

ali khezri
ali khezri

Reputation: 453

you must set the owner window in parent window like this :

 private void button1_Click(object sender, RoutedEventArgs e)
    {
        ChildWin childwindow = new ChildWin();
        childwindow.Owner = this;
        ChildWin.ShowInTaskbar = false;
        childwindow.ShowDialog();
    }

Upvotes: 2

Related Questions