PicSourceUserControl.xaml.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace ivf_tl_Manage.UserControls
  16. {
  17. /// <summary>
  18. /// PicSourceUserControl.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class PicSourceUserControl : UserControl
  21. {
  22. public PicSourceUserControl()
  23. {
  24. InitializeComponent();
  25. this.Visibility = Visibility.Collapsed;
  26. }
  27. public string ImageInfoString
  28. {
  29. get { return (string)GetValue(ImageInfoStringProperty); }
  30. set { SetValue(ImageInfoStringProperty, value); }
  31. }
  32. public static readonly DependencyProperty ImageInfoStringProperty =
  33. DependencyProperty.Register("ImageInfoString", typeof(string), typeof(PicSourceUserControl), new PropertyMetadata(null));
  34. public ImageSource ImageSourceUrl
  35. {
  36. get { return (ImageSource)GetValue(ImageSourceUrlProperty); }
  37. set { SetValue(ImageSourceUrlProperty, value); }
  38. }
  39. public static readonly DependencyProperty ImageSourceUrlProperty =
  40. DependencyProperty.Register("ImageSourceUrl", typeof(ImageSource), typeof(PicSourceUserControl), new PropertyMetadata(null, new PropertyChangedCallback(ImageSourceUrlPropertyChangedCallback)));
  41. private static void ImageSourceUrlPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  42. {
  43. if (!(d is PicSourceUserControl source)) return;
  44. if (e.NewValue == null)
  45. {
  46. source.Visibility = Visibility.Collapsed;
  47. return;
  48. }
  49. if (!(e.NewValue is ImageSource newValue))
  50. {
  51. source.Visibility = Visibility.Collapsed;
  52. return;
  53. }
  54. source.Visibility = Visibility.Visible;
  55. }
  56. public string ImageUrl { get; set; }
  57. public long ImageId { get; set; }
  58. public int developTime { get; set; }
  59. }
  60. }