UcPopups_Nameplate.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 
  2. /* ==============================================================================
  3. * 功能描述:选择路径控制,选择路径的按钮在文本框前面
  4. * 创 建 者:SAGACLOUD
  5. * 创建日期:2017/9/17
  6. * ==============================================================================*/
  7. using System;
  8. using System.IO;
  9. using System.Windows;
  10. using System.Windows.Media.Imaging;
  11. using WPG.Data;
  12. namespace WPG.UserControls
  13. {
  14. /// <summary>
  15. /// SelectPath_Start.xaml 的交互逻辑
  16. /// </summary>
  17. public partial class UcPopups_Nameplate
  18. {
  19. public UcPopups_Nameplate()
  20. {
  21. InitializeComponent();
  22. }
  23. private void Button_Click(object sender, RoutedEventArgs e)
  24. {
  25. Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
  26. dialog.Title = "请选择文件路径";
  27. dialog.Filter =
  28. "All Image Files|*.bmp;*.ico;*.gif;*.jpeg;*.jpg;*.png;*.tif;*.tiff|"+"Windows Bitmap(*.bmp)|*.bmp|"+
  29. "Windows Icon(*.ico)|*.ico|"+
  30. "Graphics Interchange Format (*.gif)|(*.gif)|"+
  31. "JPEG File Interchange Format (*.jpg)|*.jpg;*.jpeg|"+
  32. "Portable Network Graphics (*.png)|*.png|"+
  33. "Tag Image File Format (*.tif)|*.tif;*.tiff";
  34. if (dialog.ShowDialog() ==true)
  35. {
  36. //this.Tag = dialog.FileName;
  37. //string foldPath =Path.GetFileName(dialog.FileName);
  38. if (this.DataContext is Property property)
  39. {
  40. property.Value = dialog.FileName;
  41. property.ExtendClickInvoke();
  42. }
  43. }
  44. }
  45. private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
  46. {
  47. if (this.DataContext is Property property)
  48. {
  49. property.ItemClickInvoke();
  50. }
  51. }
  52. }
  53. }