Im making a WPF App. What i want to do is open OpenFileDialog
property in path in project.
My code:
OpenFileDialog openPicture = new OpenFileDialog();
openPicture.Filter = "Image files|*.bmp;*.jpg;*.gif;*.png;*.tif";
openPicture.FilterIndex = 1;
if (openPicture.ShowDialog() == true)
{
string filepath = openPicture.FileName;
}
I want to acces ExampleImages
folder in my project:
The only solution that i found is using this (Another question):
openPicture.InitialDirectory = Path.Combine(Path.GetDirectoryName(Application.StartupPath), "FolderName");
But it seems like Application.StartupPath
is hide in using System.Windows.Forms
and i cant acces it in my WPF app. Can you explain me, how to force OpenFileDialog
to open into my project folder?