I need to show a folder dialog box so the user can select a path before my application runs. I have everything working fine but I can't seem to be able to keep the error MessageBox on the foreground. If the user selects the wrong path a message box will pop up but it will stay in the background behind any open window on the desktop.
I'm new to WPF, with the winforms version of this application I could specify fdb.ShowDialog(this) and it would keep the error messagebox on the foreground. But with WPF the message box window always stays behind all other open windows.
Any ideas on how I could solve this? Thanks.
while (!found)
{
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if ((File.Exists(Path.Combine(fbd.SelectedPath, "user.exe"))))
return fbd.SelectedPath;
else
System.Windows.Forms.MessageBox.Show("Cannot find user.exe in the selected path! Please try again.", "File Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
}