WindBlockSmall.xaml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <UserControl x:Class="NEIntelligentControl2.Views.Matrix.WindBlockSmall"
  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="39" d:DesignWidth="81" MouseLeftButtonDown="UserControl_MouseLeftButtonDown">
  9. <UserControl.Resources>
  10. <Style x:Key="CardBackground" TargetType="Grid">
  11. <Setter Property="Background" Value="White"/>
  12. <Style.Triggers>
  13. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="0">
  14. <Setter Property="Background" Value="#FFB0973F"/>
  15. </DataTrigger>
  16. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="1">
  17. <Setter Property="Background" Value="#FFCFF1E8"/>
  18. </DataTrigger>
  19. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="2">
  20. <Setter Property="Background" Value="LightBlue"/>
  21. </DataTrigger>
  22. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="3">
  23. <Setter Property="Background" Value="#FFCFF1E8"/>
  24. </DataTrigger>
  25. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="4">
  26. <Setter Property="Background" Value="LightGreen"/>
  27. </DataTrigger>
  28. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="5">
  29. <Setter Property="Background" Value="Red"/>
  30. </DataTrigger>
  31. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="6">
  32. <Setter Property="Background" Value="Orange"/>
  33. </DataTrigger>
  34. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="7">
  35. <Setter Property="Background" Value="#FFC7D3DD"/>
  36. </DataTrigger>
  37. </Style.Triggers>
  38. </Style>
  39. <Style x:Key="TextStyle" TargetType="TextBlock">
  40. <Setter Property="HorizontalAlignment" Value="Right"/>
  41. <Setter Property="Foreground" Value="#FFCBBEC0"/>
  42. <Style.Triggers>
  43. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="0">
  44. <Setter Property="Foreground" Value="#FF736E26"/>
  45. </DataTrigger>
  46. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="1">
  47. <Setter Property="Foreground" Value="#FF69A953"/>
  48. </DataTrigger>
  49. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="2">
  50. <Setter Property="Foreground" Value="Blue"/>
  51. </DataTrigger>
  52. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="3">
  53. <Setter Property="Foreground" Value="#FF69A953"/>
  54. </DataTrigger>
  55. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="4">
  56. <Setter Property="Foreground" Value="Green"/>
  57. </DataTrigger>
  58. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="5">
  59. <Setter Property="Foreground" Value="White"/>
  60. </DataTrigger>
  61. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="6">
  62. <Setter Property="Foreground" Value="White"/>
  63. </DataTrigger>
  64. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="7">
  65. <Setter Property="Foreground" Value="#FF606C75"/>
  66. </DataTrigger>
  67. </Style.Triggers>
  68. </Style>
  69. </UserControl.Resources>
  70. <Grid x:Name="g" Margin="1" Style="{StaticResource CardBackground}" ToolTip="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=ToolTipValue}" SnapsToDevicePixels="True">
  71. <Grid>
  72. <Grid.Style>
  73. <Style TargetType="Grid">
  74. <Style.Triggers>
  75. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="True">
  76. <Setter Property="Visibility" Value="Visible"/>
  77. </DataTrigger>
  78. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="False">
  79. <Setter Property="Visibility" Value="Collapsed"/>
  80. </DataTrigger>
  81. </Style.Triggers>
  82. </Style>
  83. </Grid.Style>
  84. <TextBlock Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Title, Mode=TwoWay}" Style="{StaticResource TextStyle}" HorizontalAlignment="Center" FontWeight="Bold" VerticalAlignment="Center"/>
  85. </Grid>
  86. <Grid x:Name="_GDMain" Margin="1">
  87. <Grid.Style>
  88. <Style TargetType="Grid">
  89. <Style.Triggers>
  90. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="False">
  91. <Setter Property="Visibility" Value="Visible"/>
  92. </DataTrigger>
  93. <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="True">
  94. <Setter Property="Visibility" Value="Hidden"/>
  95. </DataTrigger>
  96. </Style.Triggers>
  97. </Style>
  98. </Grid.Style>
  99. <Grid.RowDefinitions>
  100. <RowDefinition/>
  101. <RowDefinition/>
  102. <RowDefinition/>
  103. </Grid.RowDefinitions>
  104. <TextBlock x:Name="_TBTitle" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Title, Mode=TwoWay}" Style="{StaticResource TextStyle}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Top" FontSize="10"/>
  105. <TextBlock x:Name="_TBTop" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=TopValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
  106. <TextBlock x:Name="_TBMidle" Grid.Row="1" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=MiddleValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
  107. <TextBlock x:Name="_TBBottom" Grid.Row="2" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=BottomValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
  108. </Grid>
  109. </Grid>
  110. </UserControl>