终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

108 lines
3.7 KiB

  1. using BPASmartClient.Compiler;
  2. using BPASmartClient.MessageName.接收消息Model.物料仓;
  3. using BPASmartClient.SCADAControl.Converters;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.ComponentModel;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. namespace BPASmartClient.SCADAControl.CustomerControls
  21. {
  22. /// <summary>
  23. /// TheDataGrid.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class TheDataGrid :DataGrid, IExecutable
  26. {
  27. public event EventHandler PropertyChange; //声明一个事件
  28. public TheDataGrid()
  29. {
  30. InitializeComponent();
  31. ResourceDictionary languageResDic = new ResourceDictionary();
  32. languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
  33. this.Resources.MergedDictionaries.Add(languageResDic);
  34. // Style = Application.Current.Resources["DesignTheDataGrid"] as Style;
  35. MinWidth = 100;
  36. MinHeight = 100;
  37. ItemsString =new ItemsListObj()
  38. {
  39. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  40. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  41. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  42. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  43. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  44. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  45. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  46. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  47. new datalist { Name="23232",Description="wwewewew",Messgae="564654645"},
  48. };
  49. }
  50. public ItemsListObj ItemsString
  51. {
  52. get { return (ItemsListObj)GetValue(ItemsStringProperty); }
  53. set { SetValue(ItemsStringProperty,value); }
  54. }
  55. public static readonly DependencyProperty ItemsStringProperty =
  56. DependencyProperty.Register("ItemsString",typeof(ItemsListObj),typeof(TheDataGrid),new PropertyMetadata(null));
  57. public string ControlType => "控件";
  58. private bool isExecuteState;
  59. public bool IsExecuteState
  60. {
  61. get { return isExecuteState; }
  62. set
  63. {
  64. isExecuteState = value;
  65. if (IsExecuteState)
  66. {
  67. Style = null;
  68. Register();
  69. }
  70. }
  71. }
  72. /// <summary>
  73. /// 注册需要处理的事件
  74. /// </summary>
  75. public void Register()
  76. {
  77. // 运行时进行项目绑定
  78. Binding binding = new Binding();
  79. binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self };
  80. binding.Path = new PropertyPath("ItemsString");
  81. SetBinding(ItemsSourceProperty,binding);
  82. }
  83. private void MyButton_Click(object sender,RoutedEventArgs e)
  84. {
  85. }
  86. }
  87. public class datalist
  88. {
  89. public string Name { get; set; }
  90. public string Description { get; set; }
  91. public string Messgae { get; set; }
  92. }
  93. }