0

I have a main Window.Then if you touch settings button a new modal Window is shown with some options..Then you click an option and a new Window (lets call it "Settings") is shown.Both windows have as owner the main Window. Our new window(Settings) may open new window having itself as owner for example if you want to add a new staff member.And here is the problem. When you close the new window and then close Settings window the main Window is minimized... However this doesnt happen if Settings window dont open any other window...

this is how i show the forms

 UserForm f = new UserForm();
            f.Owner = this;
            f.Show(); 
GorillaApe
  • 3,611
  • 10
  • 63
  • 106
  • 1
    It might be helpful to post a simple code example which demonstrates the problem. – H.B. Oct 16 '11 at 13:18
  • you might also want to add some screenshots in addition to the source code which might help in this case. – gprasant Oct 16 '11 at 13:53

3 Answers3

3

Use MainWindow.Activate() on close of Child Window.

it should work

ifixthat
  • 6,137
  • 5
  • 25
  • 42
Kapil Desai
  • 33
  • 1
  • 4
2

I ran into the same problem and found an apt solution here.

Set the window owner to null before the Settings window closes.

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Owner = null;
        }
Community
  • 1
  • 1
Fahad
  • 1,364
  • 3
  • 20
  • 40
0

Can't you catch when the window is closed (OnFormClose I think) and then unminimise your main window?

Haedrian
  • 4,240
  • 2
  • 32
  • 53