// Create OpenFileDialog on button click Event! Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension. dlg.Filter = "EXCEL Files (*.xls)|*.xlsx";
dlg.Filter = "Text Files | *.txt";
dlg .Filter = "png files (*.png)|*.png|
jpg files (*.jpg)|*.jpg|
jpeg files (*.jpeg)|*.jpeg|
gif files (*.gif)|*.gif|
Image Files(*.png;*.jpg;*.jpeg;*.gif)|*.png;*.jpg;*.jpeg;*.gif";