I have a Image box and a button named Browse below ImageBox on my form.
When the User Clicks on the Browse button it should open Dialog and display images.
Below is my code.
Expand|Select|Wrap|Line Numbers
- private void btnBrowse_Click(objectsender,RoutedEventArgs e)
- {
- OpenFileDialog imageDialog =new OpenFileDialog();
- //Filter default filetype to be allowed for selection
- imageDialog.Filter = "Pictures (*.jpg)|*.jpg";
- imageDialog.FilterIndex = 1;
- //Allows multiple files to be selected
- imageDialog.Multiselect = true;
- //Call the ShowDialog method to show the dialog box
- bool? userClickedOK = imageDialog.ShowDialog();
- //Process input if the user clicked OK
- if (userClickedOK == true)
- {
- image1.Source= ;
- }
- }
Expand|Select|Wrap|Line Numbers
- if (userClickedOK == true)
- {
- image1.Source= ;
- }