Open file dialog and select a file using WPF controls and C#

I have a TextBox named textbox1 and a Button named button1.
When I click on button1 I want to browse my files to search only for image files (type jpg, png, bmp…).
And when I select an image file and click Ok in the file dialog I want the file directory to be written in the textbox1.text like this:

textbox1.Text = "C:\myfolder\myimage.jpg"

2 Answers
2

Leave a Comment