PVBlock.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <UserControl x:Class="NEIntelligentControl2.Views.Matrix.PVBlock"
  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:NEIntelligentControl2.Views.Matrix"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="800" MouseLeftButtonUp="UserControl_MouseLeftButtonUp">
  9. <UserControl.Resources>
  10. <SolidColorBrush x:Key="PowerRestrictionTextColor" Color="#FF7E7935"/>
  11. <SolidColorBrush x:Key="StandbyTextColor" Color="#FF69A953"/>
  12. <SolidColorBrush x:Key="GridConnectedTextColor" Color="#FF4B7F9E"/>
  13. <SolidColorBrush x:Key="WiteTextColor" Color="WhiteSmoke"/>
  14. <SolidColorBrush x:Key="OfflineTextColor" Color="#FF606C75"/>
  15. </UserControl.Resources>
  16. <UserControl.ContentTemplate>
  17. <DataTemplate>
  18. <Grid x:Name="_GDMain" ToolTip="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=ToolTipValue}">
  19. <Grid.RowDefinitions>
  20. <RowDefinition/>
  21. <RowDefinition Height="Auto"/>
  22. </Grid.RowDefinitions>
  23. <Grid>
  24. <Grid.ColumnDefinitions>
  25. <ColumnDefinition/>
  26. <ColumnDefinition Width="2.1*"/>
  27. </Grid.ColumnDefinitions>
  28. <Grid Grid.Column="1">
  29. <Grid.RowDefinitions>
  30. <RowDefinition/>
  31. <RowDefinition/>
  32. <RowDefinition/>
  33. </Grid.RowDefinitions>
  34. <!--电流-->
  35. <TextBlock x:Name="tbcurrent" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Current}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="12" Margin="0,0,3,0"/>
  36. <!--电压-->
  37. <TextBlock x:Name="tbvoltage" Grid.Row="1" Grid.Column="1" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Voltage}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="12" Margin="0,0,3,0"/>
  38. <!--功率-->
  39. <TextBlock x:Name="tbpower" Grid.Row="2" Grid.Column="1" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Power}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="12" Margin="0,0,3,0"/>
  40. </Grid>
  41. <TextBlock x:Name="tbname" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=PVName}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="13" Grid.RowSpan="3" FontWeight="Bold" Margin="5,0,0,0" TextWrapping="Wrap"/>
  42. </Grid>
  43. <Border x:Name="_GBottom" Grid.Row="1">
  44. <TextBlock x:Name="tbstate" Foreground="WhiteSmoke" Margin="1"/>
  45. </Border>
  46. </Grid>
  47. <DataTemplate.Triggers>
  48. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSmallModel}" Value="True">
  49. <Setter TargetName="tbname" Property="FontSize" Value="10"/>
  50. <Setter TargetName="tbcurrent" Property="FontSize" Value="10"/>
  51. <Setter TargetName="tbvoltage" Property="FontSize" Value="10"/>
  52. <Setter TargetName="tbpower" Property="FontSize" Value="10"/>
  53. <Setter TargetName="_GDMain" Property="Margin" Value="2"/>
  54. <Setter TargetName="_GDMain" Property="MaxWidth" Value="103"/>
  55. </DataTrigger>
  56. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSmallModel}" Value="False">
  57. <Setter TargetName="_GDMain" Property="Margin" Value="5"/>
  58. <Setter TargetName="_GDMain" Property="MinHeight" Value="77"/>
  59. </DataTrigger>
  60. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="UnKnow">
  61. <Setter TargetName="_GDMain" Property="Background" Value="DarkGray"/>
  62. <Setter TargetName="_GBottom" Property="Background" Value="DarkGray"/>
  63. <Setter TargetName="tbname" Property="Foreground" Value="DarkGray"/>
  64. <Setter TargetName="tbcurrent" Property="Foreground" Value="DarkGray"/>
  65. <Setter TargetName="tbvoltage" Property="Foreground" Value="DarkGray"/>
  66. <Setter TargetName="tbpower" Property="Foreground" Value="DarkGray"/>
  67. <Setter TargetName="tbstate" Property="Text" Value="状态未知"/>
  68. </DataTrigger>
  69. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="Standby">
  70. <Setter TargetName="_GDMain" Property="Background" Value="#FFCFF1E8"/>
  71. <Setter TargetName="_GBottom" Property="Background" Value="#FFA7E094"/>
  72. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource StandbyTextColor}"/>
  73. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource StandbyTextColor}"/>
  74. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource StandbyTextColor}"/>
  75. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource StandbyTextColor}"/>
  76. <Setter TargetName="tbstate" Property="Text" Value="待机状态"/>
  77. </DataTrigger>
  78. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="GridConnected">
  79. <Setter TargetName="_GDMain" Property="Background" Value="#FFC8EAFF"/>
  80. <Setter TargetName="_GBottom" Property="Background" Value="#FF88CBE3"/>
  81. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource GridConnectedTextColor}"/>
  82. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource GridConnectedTextColor}"/>
  83. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource GridConnectedTextColor}"/>
  84. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource GridConnectedTextColor}"/>
  85. <Setter TargetName="tbstate" Property="Text" Value="并网状态"/>
  86. </DataTrigger>
  87. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="Malfunction">
  88. <Setter TargetName="_GDMain" Property="Background" Value="#FFDB3333"/>
  89. <Setter TargetName="_GBottom" Property="Background" Value="#FFBA2424"/>
  90. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  91. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  92. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  93. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  94. <Setter TargetName="tbstate" Property="Text" Value="故障状态"/>
  95. </DataTrigger>
  96. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="Offline">
  97. <Setter TargetName="_GDMain" Property="Background" Value="#FFC7D3DD"/>
  98. <Setter TargetName="_GBottom" Property="Background" Value="#FFB6C3CE"/>
  99. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource OfflineTextColor}"/>
  100. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource OfflineTextColor}"/>
  101. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource OfflineTextColor}"/>
  102. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource OfflineTextColor}"/>
  103. <Setter TargetName="tbstate" Property="Text" Value="离线状态"/>
  104. </DataTrigger>
  105. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="Maintain">
  106. <Setter TargetName="_GDMain" Property="Background" Value="#FFFF720E"/>
  107. <Setter TargetName="_GBottom" Property="Background" Value="#FFD35902"/>
  108. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  109. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  110. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  111. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource WiteTextColor}"/>
  112. <Setter TargetName="tbstate" Property="Text" Value="维护状态"/>
  113. </DataTrigger>
  114. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="Restriction">
  115. <Setter TargetName="_GDMain" Property="Background" Value="#FFB0973F"/>
  116. <Setter TargetName="_GBottom" Property="Background" Value="#FF7E7935"/>
  117. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  118. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  119. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  120. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  121. <Setter TargetName="tbstate" Property="Text" Value="限电状态"/>
  122. </DataTrigger>
  123. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Status}" Value="RestrictionShutdown">
  124. <Setter TargetName="_GDMain" Property="Background" Value="#FFB0973F"/>
  125. <Setter TargetName="_GBottom" Property="Background" Value="#FF7E7935"/>
  126. <Setter TargetName="tbname" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  127. <Setter TargetName="tbcurrent" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  128. <Setter TargetName="tbvoltage" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  129. <Setter TargetName="tbpower" Property="Foreground" Value="{StaticResource PowerRestrictionTextColor}"/>
  130. <Setter TargetName="tbstate" Property="Text" Value="限电停机状态"/>
  131. </DataTrigger>
  132. </DataTemplate.Triggers>
  133. </DataTemplate>
  134. </UserControl.ContentTemplate>
  135. </UserControl>