Solved

WPF App window.ShowDialog()

Posted on 2010-11-18
4
1,457 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:brasso_42
  • 2
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 34170639
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
 
LVL 1

Author Comment

by:brasso_42
ID: 34171322
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
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 34171361
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
 
LVL 1

Author Closing Comment

by:brasso_42
ID: 34171372
Great thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now