SlotsList.xaml.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using FurnaceUI.Views.Recipes;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace FurnaceUI.Controls
  18. {
  19. /// <summary>
  20. /// PaginationList.xaml 的交互逻辑
  21. /// </summary>
  22. partial class SlotsList : UserControl, INotifyPropertyChanged
  23. {
  24. public List<BoatWaferItem> Items
  25. {
  26. get { return (List<BoatWaferItem>)GetValue(ItemsProperty); }
  27. set { SetValue(ItemsProperty, value); }
  28. }
  29. public static readonly DependencyProperty ItemsProperty =
  30. DependencyProperty.Register("Items", typeof(List<BoatWaferItem>), typeof(SlotsList), new PropertyMetadata(null, new PropertyChangedCallback(RenderUpdateByPropertyChanged)));
  31. public bool IsListEnable
  32. {
  33. get { return (bool)GetValue(IsListEnableProperty); }
  34. set { SetValue(IsListEnableProperty, value); }
  35. }
  36. public static readonly DependencyProperty IsListEnableProperty =
  37. DependencyProperty.Register("IsListEnable", typeof(bool), typeof(SlotsList), new UIPropertyMetadata(true, new PropertyChangedCallback(RenderUpdateByPropertyChanged)));
  38. public int CurrentItemIndex
  39. {
  40. get { return (int)GetValue(CurrentItemIndexProperty); }
  41. set { SetValue(CurrentItemIndexProperty, value); }
  42. }
  43. public static readonly DependencyProperty CurrentItemIndexProperty =
  44. DependencyProperty.Register("CurrentItemIndex", typeof(int), typeof(SlotsList), new PropertyMetadata(-1, new PropertyChangedCallback(RenderUpdateByPropertyChanged)));
  45. public SlotsList()
  46. {
  47. InitializeComponent();
  48. }
  49. public void UpdateSlotsList()
  50. {
  51. list.ItemsSource = Items;
  52. //list.IsEnabled = IsListEnable;
  53. }
  54. public event PropertyChangedEventHandler PropertyChanged;
  55. public static void RenderUpdateByPropertyChanged(DependencyObject dependency, DependencyPropertyChangedEventArgs e)
  56. {
  57. if (dependency is SlotsList hslThermometer)
  58. {
  59. hslThermometer.UpdateSlotsList();
  60. }
  61. }
  62. private void Button_Click_1(object sender, RoutedEventArgs e)
  63. {
  64. Button btn = sender as Button;
  65. CurrentItemIndex = (int)btn.Tag;
  66. }
  67. }
  68. }