App.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <Application x:Class="NEIntelligentControl2.App"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:NEIntelligentControl2"
  5. Startup="Application_Startup" ShutdownMode="OnMainWindowClose" DispatcherUnhandledException="Application_DispatcherUnhandledException">
  6. <Application.Resources>
  7. <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#7FF4F4F4"/>
  8. <!--滚动条-->
  9. <ControlTemplate x:Key="ScrollViewerTemplate" TargetType="{x:Type ScrollViewer}">
  10. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  11. <Grid.ColumnDefinitions>
  12. <ColumnDefinition Width="*"/>
  13. <ColumnDefinition Width="Auto"/>
  14. </Grid.ColumnDefinitions>
  15. <Grid.RowDefinitions>
  16. <RowDefinition Height="*"/>
  17. <RowDefinition Height="Auto"/>
  18. </Grid.RowDefinitions>
  19. <Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/>
  20. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  21. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource ScrollBarStyle}"/>
  22. <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource ScrollBarStyle}"/>
  23. </Grid>
  24. </ControlTemplate>
  25. <!--滚动条颜色、圆角等设置-->
  26. <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
  27. <Setter Property="OverridesDefaultStyle" Value="true"/>
  28. <Setter Property="IsTabStop" Value="false"/>
  29. <Setter Property="Template">
  30. <Setter.Value>
  31. <ControlTemplate TargetType="{x:Type Thumb}">
  32. <!--滚动条颜色和圆角设置-->
  33. <Rectangle Name="thumbRect" Fill="#CC6495ED" RadiusX="3" RadiusY="3"/>
  34. <!--鼠标拉动滚动条时的颜色-->
  35. <ControlTemplate.Triggers>
  36. <Trigger Property="IsMouseOver" Value="True">
  37. <Setter Property="Fill" Value="CornflowerBlue" TargetName="thumbRect" />
  38. </Trigger>
  39. </ControlTemplate.Triggers>
  40. </ControlTemplate>
  41. </Setter.Value>
  42. </Setter>
  43. </Style>
  44. <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  45. <Setter Property="OverridesDefaultStyle" Value="true"/>
  46. <Setter Property="Background" Value="Transparent"/>
  47. <Setter Property="Focusable" Value="false"/>
  48. <Setter Property="IsTabStop" Value="false"/>
  49. <Setter Property="Template">
  50. <Setter.Value>
  51. <ControlTemplate TargetType="{x:Type RepeatButton}">
  52. <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
  53. </ControlTemplate>
  54. </Setter.Value>
  55. </Setter>
  56. </Style>
  57. <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  58. <Setter Property="OverridesDefaultStyle" Value="true"/>
  59. <Setter Property="Background" Value="Transparent"/>
  60. <Setter Property="Focusable" Value="false"/>
  61. <Setter Property="IsTabStop" Value="false"/>
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate TargetType="{x:Type RepeatButton}">
  65. <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
  66. </ControlTemplate>
  67. </Setter.Value>
  68. </Setter>
  69. </Style>
  70. <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
  71. <Setter Property="Background" Value="#77F0F8FF"/>
  72. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  73. <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
  74. <!--滚动条宽度-->
  75. <Setter Property="Width" Value="8"/>
  76. <Setter Property="MinWidth" Value="6"/>
  77. <Setter Property="Template">
  78. <Setter.Value>
  79. <ControlTemplate TargetType="{x:Type ScrollBar}">
  80. <!--滚动条背景色-->
  81. <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true" Width="8">
  82. <Grid.RowDefinitions>
  83. <RowDefinition />
  84. </Grid.RowDefinitions>
  85. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  86. <Track.DecreaseRepeatButton>
  87. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  88. </Track.DecreaseRepeatButton>
  89. <Track.IncreaseRepeatButton>
  90. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  91. </Track.IncreaseRepeatButton>
  92. <Track.Thumb>
  93. <Thumb Style="{StaticResource ScrollBarThumb}"/>
  94. </Track.Thumb>
  95. </Track>
  96. </Grid>
  97. <ControlTemplate.Triggers>
  98. <Trigger Property="IsEnabled" Value="false">
  99. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  100. </Trigger>
  101. </ControlTemplate.Triggers>
  102. </ControlTemplate>
  103. </Setter.Value>
  104. </Setter>
  105. <Style.Triggers>
  106. <Trigger Property="Orientation" Value="Horizontal">
  107. <Setter Property="Width" Value="Auto"/>
  108. <Setter Property="MinWidth" Value="0"/>
  109. <Setter Property="Height" Value="6"/>
  110. <Setter Property="MinHeight" Value="6"/>
  111. <Setter Property="Background" Value="#77F0F8FF"/>
  112. <Setter Property="Template">
  113. <Setter.Value>
  114. <ControlTemplate TargetType="{x:Type ScrollBar}">
  115. <Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true">
  116. <Grid.ColumnDefinitions>
  117. <ColumnDefinition />
  118. </Grid.ColumnDefinitions>
  119. <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
  120. <Track.DecreaseRepeatButton>
  121. <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  122. </Track.DecreaseRepeatButton>
  123. <Track.IncreaseRepeatButton>
  124. <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  125. </Track.IncreaseRepeatButton>
  126. <Track.Thumb>
  127. <Thumb Style="{StaticResource ScrollBarThumb}" />
  128. </Track.Thumb>
  129. </Track>
  130. </Grid>
  131. <ControlTemplate.Triggers>
  132. <Trigger Property="IsEnabled" Value="false">
  133. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  134. </Trigger>
  135. </ControlTemplate.Triggers>
  136. </ControlTemplate>
  137. </Setter.Value>
  138. </Setter>
  139. </Trigger>
  140. </Style.Triggers>
  141. </Style>
  142. <!--升压站背景颜色-->
  143. <SolidColorBrush x:Key="BoostStationBackground" Color="#FF0B2F6A"/>
  144. <!--升压站控件颜色-->
  145. <SolidColorBrush x:Key="BoostStationUndefined" Color="DarkGray"/>
  146. <SolidColorBrush x:Key="BoostStationOn" Color="#FFFF0005"/>
  147. <SolidColorBrush x:Key="BoostStationOff" Color="#FF1B9D3A"/>
  148. <!--按钮默认-->
  149. <Style x:Key="CancelButtonStyle" TargetType="{x:Type Button}">
  150. <Setter Property="Background" Value="#FFFE8864"/>
  151. <Setter Property="Foreground" Value="WhiteSmoke"/>
  152. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  153. <Setter Property="VerticalContentAlignment" Value="Center"/>
  154. <Setter Property="Padding" Value="17,6"/>
  155. <Setter Property="FontSize" Value="14"/>
  156. <Setter Property="BorderThickness" Value="0"/>
  157. <Setter Property="Margin" Value="20,0"/>
  158. <Setter Property="Template">
  159. <Setter.Value>
  160. <ControlTemplate TargetType="{x:Type Button}">
  161. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  162. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  163. </Border>
  164. <ControlTemplate.Triggers>
  165. <Trigger Property="IsMouseOver" Value="true">
  166. <Setter Property="Background" TargetName="border" Value="#FFFE9777"/>
  167. </Trigger>
  168. <Trigger Property="IsPressed" Value="true">
  169. <Setter Property="Background" TargetName="border" Value="#FFFE8864"/>
  170. </Trigger>
  171. </ControlTemplate.Triggers>
  172. </ControlTemplate>
  173. </Setter.Value>
  174. </Setter>
  175. </Style>
  176. <Style x:Key="ConfirmButtonStyle" TargetType="{x:Type Button}">
  177. <Setter Property="Background" Value="#FF006ACC"/>
  178. <Setter Property="Foreground" Value="WhiteSmoke"/>
  179. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  180. <Setter Property="VerticalContentAlignment" Value="Center"/>
  181. <Setter Property="Padding" Value="17,6"/>
  182. <Setter Property="FontSize" Value="14"/>
  183. <Setter Property="BorderThickness" Value="0"/>
  184. <Setter Property="Margin" Value="20,0"/>
  185. <Setter Property="Template">
  186. <Setter.Value>
  187. <ControlTemplate TargetType="{x:Type Button}">
  188. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" CornerRadius="3">
  189. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  190. </Border>
  191. <ControlTemplate.Triggers>
  192. <Trigger Property="IsMouseOver" Value="true">
  193. <Setter Property="Background" TargetName="border" Value="#FF2E81CC"/>
  194. </Trigger>
  195. <Trigger Property="IsPressed" Value="true">
  196. <Setter Property="Background" TargetName="border" Value="#FF006ACC"/>
  197. </Trigger>
  198. </ControlTemplate.Triggers>
  199. </ControlTemplate>
  200. </Setter.Value>
  201. </Setter>
  202. </Style>
  203. <!--按钮默认结束-->
  204. </Application.Resources>
  205. </Application>