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
LVL 1
brasso_42Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Gautham JanardhanConnect With a Mentor Commented:
ohhh vb.. forgot that it's me i think instead of this.
window.ShowDialog(me).. what it does is it tells that window 2's parent is current window
0
 
Gautham JanardhanCommented:
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)
0
 
brasso_42Author Commented:
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
0
 
brasso_42Author Commented:
Great thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.