Wednesday, May 28, 2008

Missing WPF Dialog windows

We have been having some fun (read defects raised) with dialog windows in our WPF app. I remember when we wrote the system that showed a custom Warning Message that we wanted it to be displayed modally and not show up in the task bar. Sounds simple so far. However, if I tabbed away from the app and came back to it, the dialog was hiding. Naughty little dialog. Our fix at the time was to set Topmost = true. This just got raised as a defect because it was top most for all apps. A bit of a pain for the users as it covered up other apps (probably the bug tracking system LOL). The fix was really simple and one the makes you feel like a bit of a tool. Window window = new Window(); window.Owner = App.Current.MainWindow; //Or the relevant window. window...... //set other properties. window.ShowDialog(); Now that we don't have an Orphaned window he is so much better behaved. Good little dialog.

No comments: