I have been searching up and down the web and unfortunately never came across an issue quite like mine, so here goes:
My C# WPF application won't show me no OpenFileDialogs or SafeFileDialogs.
private void btnBrowseNet_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.CheckPathExists = true;
ofd.Multiselect = false;
ofd.Title = "Open Network Configuration Batch file...";
ofd.ValidateNames = true;
ofd.Filter = "Comma Seperated Value Files|*.csv";
if (ofd.ShowDialog() == true)
{
//...
}
}
This exact code does in one occasion exactly what it is supposed to do and hardly five minutes later I can click the button all I want, nothing happens but the mouse pointer turning into a little busy-indicator and then nothing. I can step through the method or do something like this
bool? shown = ofd.ShowDialog();
But no matter what, the dialog won't show. Of course, shown will be false in that case. I wasted one and a half hours searching yesterday and right when I quit I tried it again and all of a sudden it worked. Sometimes it works, sometimes it doesn't. But it seems to be project specific because I can paste the same code into a new project and it works like it is supposed to do. Also, that's the only thing about the project that seems fishy. Everything else works as intended.
Has anyone on here ever experienced something similar and thus an idea of what on earth I could do? Any help weould be highly appreciated.
Microsoft.Win32.OpenFileDialog
and not the equivalentSystem.Windows.Forms.OpenFileDialog
. – Cyanamide