终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

129 rindas
7.0 KiB

  1. <UserControl x:Class="FryPot_DosingSystem.View.FryPotMonitorView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:FryPot_DosingSystem.View"
  7. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <UserControl.DataContext>
  11. <vm:FryPotMonitorViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <Style x:Key="dataGrid" TargetType="DataGrid" >
  15. <Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/>
  16. <Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/>
  17. <Setter Property="BorderThickness" Value="0"/>
  18. <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
  19. <Setter Property="CanUserResizeColumns" Value="False"/>
  20. <Setter Property="HeadersVisibility" Value="Column"/>
  21. <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
  22. <Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
  23. </Style>
  24. <Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
  25. <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
  26. <Setter Property="VerticalAlignment" Value="Center"/>
  27. <Setter Property="Background" Value="#FF2AB2E7"></Setter>
  28. <Setter Property="Foreground" Value="White"></Setter>
  29. <Setter Property="BorderThickness" Value="1"></Setter>
  30. <Setter Property="BorderBrush" Value="White"></Setter>
  31. <Setter Property="Height" Value="30"/>
  32. <Setter Property="FontSize" Value="16"/>
  33. <Setter Property="FontWeight" Value="Heavy"/>
  34. <Setter Property="Margin" Value="-1,-1,-1,-1"/>
  35. </Style>
  36. <Style x:Key="rowStyle" TargetType="DataGridRow">
  37. <Setter Property="Height" Value="35"/>
  38. <Setter Property="Foreground" Value="SkyBlue"/>
  39. <Style.Triggers>
  40. <Trigger Property="AlternationIndex" Value="0">
  41. <Setter Property="Background" Value="Transparent" />
  42. </Trigger>
  43. <Trigger Property="AlternationIndex" Value="1">
  44. <Setter Property="Background" Value="Transparent" />
  45. </Trigger>
  46. <Trigger Property="IsMouseOver" Value="True">
  47. <Setter Property="Background" Value="#000066" />
  48. </Trigger>
  49. </Style.Triggers>
  50. </Style>
  51. <Style x:Key="textboxStyle" TargetType="TextBox">
  52. <Setter Property="Background" Value="Transparent"/>
  53. <Setter Property="Foreground" Value="SkyBlue"/>
  54. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  55. <Setter Property="VerticalContentAlignment" Value="Center"/>
  56. <Setter Property="FontSize" Value="16"/>
  57. <Setter Property="BorderThickness" Value="0"/>
  58. <Setter Property="CaretBrush" Value="LightBlue"/>
  59. <Style.Triggers>
  60. <Trigger Property="IsFocused" Value="True">
  61. <Setter Property="Cursor" Value="Arrow"/>
  62. </Trigger>
  63. </Style.Triggers>
  64. </Style>
  65. <Style x:Key="cellStyle" TargetType="DataGridCell">
  66. <Style.Triggers>
  67. <Trigger Property="IsSelected" Value="True">
  68. <Setter Property="Background" Value="Transparent"/>
  69. <Setter Property="Foreground"
  70. Value="SkyBlue"/>
  71. </Trigger>
  72. <Trigger Property="IsSelected" Value="false">
  73. <Setter Property="Background" Value="Transparent"/>
  74. <Setter Property="Foreground"
  75. Value="SkyBlue"/>
  76. </Trigger>
  77. </Style.Triggers>
  78. </Style>
  79. <Style x:Key="dgCellstyle" TargetType="TextBlock">
  80. <Setter Property="HorizontalAlignment" Value="Center"></Setter>
  81. <Setter Property="VerticalAlignment" Value="Center"/>
  82. <Setter Property="FontSize" Value="16"/>
  83. </Style>
  84. </UserControl.Resources>
  85. <DataGrid Grid.Row="1" ItemsSource="{Binding variableMonitorModels}" GridLinesVisibility="All" Background="Transparent"
  86. AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
  87. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  88. <DataGrid.Columns>
  89. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  90. <DataGridTemplateColumn.CellTemplate>
  91. <DataTemplate>
  92. <TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
  93. </DataTemplate>
  94. </DataGridTemplateColumn.CellTemplate>
  95. </DataGridTemplateColumn>
  96. <DataGridTextColumn Width="0.2*" Header="变量名" Binding="{Binding VarName}" ElementStyle="{StaticResource dgCellstyle }">
  97. </DataGridTextColumn>
  98. <DataGridTextColumn Width="0.2*" Header="描述" Binding="{Binding Notes}" ElementStyle="{StaticResource dgCellstyle }">
  99. </DataGridTextColumn>
  100. <DataGridTextColumn Width="0.2*" Header="实时状态值" Binding="{Binding CurrentValue}" ElementStyle="{StaticResource dgCellstyle }">
  101. </DataGridTextColumn>
  102. <DataGridTextColumn Width="0.2*" Header="PLC地址" Binding="{Binding PLCAddress}" ElementStyle="{StaticResource dgCellstyle }">
  103. </DataGridTextColumn>
  104. <DataGridTextColumn Width="0.2*" Header="ModbusTcp地址" Binding="{Binding ModbusTcpAddress}" ElementStyle="{StaticResource dgCellstyle }">
  105. </DataGridTextColumn>
  106. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  107. <DataGridTemplateColumn.CellTemplate>
  108. <DataTemplate>
  109. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  110. </DataTemplate>
  111. </DataGridTemplateColumn.CellTemplate>
  112. </DataGridTemplateColumn>-->
  113. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  114. <DataGridTemplateColumn.CellTemplate>
  115. <DataTemplate>
  116. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  117. </DataTemplate>
  118. </DataGridTemplateColumn.CellTemplate>
  119. </DataGridTemplateColumn>-->
  120. </DataGrid.Columns>
  121. </DataGrid>
  122. </UserControl>