Link to home
Start Free TrialLog in
Avatar of brasso_42
brasso_42

asked on

WPF App window.ShowDialog()

Hi

I have an app which has a button that opens a second window and disables the window that opened it.  

This works fine, but if I browse away from the app and then click on it again in the task bar the disabled window appears ontop of the new window.

How can I get it to display the correct window when the app is clicked in the task bar.

My code so far is very simple:

Dim window As New Window2
window.ShowDialog()

Thanks
Brasso
Avatar of Gautham Janardhan
Gautham Janardhan

you can set the AlwaysOnTop property of the child window to true. also when doing window.ShowDialog() if you are doing this from the parent window do this instead window.ShowDialog(this)
Avatar of brasso_42

ASKER

Hi

I used Topmost="True" and that worked a treat.  I dont understand the w.dow.showdialog(this) bit though.  

this -- is not recognised.  what differance does that make?

Thanks brasso
ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great thanks