46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using Microsoft.Win32;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace filedialog
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnFire_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
ofd.Filter = "Image files |*.bmp;*.jpg;*.png";
|
|
ofd.FilterIndex = 1;
|
|
bool?success = ofd.ShowDialog();
|
|
|
|
if (success == true)
|
|
{
|
|
string path = ofd.FileName;
|
|
|
|
tbInfo.Text = path;
|
|
|
|
imageholder.Source = new BitmapImage(new Uri(path));
|
|
}
|
|
else
|
|
{
|
|
//no
|
|
}
|
|
}
|
|
}
|
|
} |