App.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <Application x:Class="MeterVision.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:MeterVision">
  5. <!--StartupUri="MainWindow.xaml">-->
  6. <Application.Resources>
  7. <ResourceDictionary>
  8. <!--<ResourceDictionary.MergedDictionaries>
  9. --><!-- Primary resource dictionary --><!--
  10. <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
  11. --><!--<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
  12. --><!-- Icon pack --><!--
  13. <ResourceDictionary Source="pack://application:,,,/MaterialDesignIcons.Wpf;component/Themes/MaterialDesignIcons.xaml" />-->
  14. <!--<ResourceDictionary Source="pack://application:,,,/FontAwesome.WPF;component/Themes/Regular.xaml"/>--><!--
  15. </ResourceDictionary.MergedDictionaries>-->
  16. <Style TargetType="TextBlock">
  17. <Setter Property="Text" Value="{Binding}" />
  18. </Style>
  19. <!--带有虚线的Brush Start-->
  20. <DrawingBrush x:Key="borderBrush" Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile">
  21. <DrawingBrush.Drawing>
  22. <DrawingGroup>
  23. <GeometryDrawing Brush="#008000">
  24. <GeometryDrawing.Geometry>
  25. <GeometryGroup>
  26. <RectangleGeometry Rect="0,0,50,50" />
  27. <RectangleGeometry Rect="50,50,50,50" />
  28. </GeometryGroup>
  29. </GeometryDrawing.Geometry>
  30. </GeometryDrawing>
  31. </DrawingGroup>
  32. </DrawingBrush.Drawing>
  33. </DrawingBrush>
  34. <!--带有虚线的Brush End-->
  35. <!--控制移动的按钮样式 Start-->
  36. <Style x:Key="MoveButtonStyle" TargetType="{x:Type Button}">
  37. <Style.Triggers>
  38. <Trigger Property="IsMouseOver" Value="true">
  39. <Setter Property="Background" Value="#000000" />
  40. <Setter Property="BorderThickness" Value="1" />
  41. </Trigger>
  42. </Style.Triggers>
  43. <Setter Property="Background" Value="Transparent" />
  44. <Setter Property="BorderThickness" Value="0" />
  45. </Style>
  46. <!--控制移动的按钮样式 End-->
  47. <!--控制移动的按钮样式 Start-->
  48. <Style x:Key="MoveButtonStyle1" TargetType="{x:Type Button}">
  49. <Setter Property="Background" Value="Transparent"/>
  50. <Setter Property="BorderThickness" Value="0"/>
  51. <Setter Property="Template">
  52. <Setter.Value>
  53. <ControlTemplate TargetType="{x:Type Button}">
  54. <Border Background="{TemplateBinding Background}" BorderBrush="#007ACC"
  55. BorderThickness="{TemplateBinding BorderThickness}">
  56. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  57. </Border>
  58. </ControlTemplate>
  59. </Setter.Value>
  60. </Setter>
  61. <Style.Triggers>
  62. <Trigger Property="IsMouseOver" Value="True">
  63. <Setter Property="Background" Value="#CCCEDB"/>
  64. <Setter Property="BorderThickness" Value="1"/>
  65. </Trigger>
  66. </Style.Triggers>
  67. </Style>
  68. <!--控制移动的按钮样式 End-->
  69. <!--控制移动的按钮样式 Start2-->
  70. <Style x:Key="MoveButtonStyle2" TargetType="{x:Type Button}">
  71. <Setter Property="Background" Value="Transparent"/>
  72. <Setter Property="BorderThickness" Value="0"/>
  73. <Setter Property="Template">
  74. <Setter.Value>
  75. <ControlTemplate TargetType="{x:Type Button}">
  76. <Border Background="{TemplateBinding Background}" BorderBrush="#007ACC"
  77. BorderThickness="{TemplateBinding BorderThickness}">
  78. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  79. </Border>
  80. </ControlTemplate>
  81. </Setter.Value>
  82. </Setter>
  83. <Style.Triggers>
  84. <Trigger Property="IsMouseOver" Value="True">
  85. <Setter Property="Background" Value="Transparent"/>
  86. <Setter Property="BorderThickness" Value="1"/>
  87. </Trigger>
  88. </Style.Triggers>
  89. </Style>
  90. <!--控制移动的按钮样式 End2-->
  91. <!--<DataGrid.RowStyle >-->
  92. <Style x:Key="dataGridRowStyle" TargetType="DataGridRow">
  93. <Setter Property="Background" Value="White"/>
  94. <Setter Property="VerticalAlignment" Value="Center" />
  95. <Setter Property="VerticalContentAlignment" Value="Center" />
  96. <Setter Property="Height" Value="30"/>
  97. <Style.Triggers>
  98. <Trigger Property="IsMouseOver" Value="True">
  99. <Setter Property="Background" Value="#CEDBEF"/>
  100. </Trigger>
  101. <Trigger Property="IsSelected" Value="True">
  102. <Setter Property="Background" Value="#A8C6EE"/>
  103. <!--<Setter Property="Foreground" Value="White" />-->
  104. </Trigger>
  105. </Style.Triggers>
  106. </Style>
  107. <!--</DataGrid.RowStyle>-->
  108. <Style x:Key="dataGridCellStyle" TargetType="DataGridCell">
  109. <Setter Property="BorderThickness" Value="0"/>
  110. <!--<Setter Property="MinWidth" Value="85"/>-->
  111. <Style.Triggers>
  112. <Trigger Property="IsSelected" Value="True">
  113. <Setter Property="Background" Value="#A8C6EE"/>
  114. <Setter Property="Foreground" Value="#000000"/>
  115. </Trigger>
  116. </Style.Triggers>
  117. </Style>
  118. <!--登陆页面按钮样式2020-07-07 guozhao-->
  119. <Style x:Key="NewButton" TargetType="{x:Type Button}">
  120. <Setter Property="Padding" Value="1"/>
  121. <Setter Property="Template">
  122. <Setter.Value>
  123. <ControlTemplate TargetType="{x:Type Button}">
  124. <Grid Cursor="Hand">
  125. <Border x:Name="_Border" Background="{TemplateBinding Background}" CornerRadius="5" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
  126. </Border>
  127. <!--ContentPresenter的作用就是显示内容,但Control类没有这个Content属性,所以在Control类之上写了一个ContentControl类,然后ContentPresenter(其显示依赖于ContentControl类)负责将ContentControl的Content属性显示出来。每个控件都有一个默认的ContentPresenter用于显示Content内容,这种控件为内容控件-->
  128. <!--SnapsToDevicePixels获取或设置一个值,该值确定在呈现过程中,此元素的呈现是否应使用特定于设备的像素设置。 这是依赖项属性。-->
  129. <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  130. </Grid>
  131. <!--定义触发器-->
  132. <ControlTemplate.Triggers>
  133. <Trigger Property="IsMouseOver" Value="True">
  134. <Setter Property="Background" TargetName="_Border">
  135. <Setter.Value>
  136. <SolidColorBrush Color="#ef3c62"/>
  137. </Setter.Value>
  138. </Setter>
  139. </Trigger>
  140. <Trigger Property="IsEnabled" Value="False">
  141. <Setter Property="Background" TargetName="_Border">
  142. <Setter.Value>
  143. <SolidColorBrush Color="Gray"/>
  144. </Setter.Value>
  145. </Setter>
  146. </Trigger>
  147. </ControlTemplate.Triggers>
  148. <!--定义触发器_End-->
  149. </ControlTemplate>
  150. </Setter.Value>
  151. </Setter>
  152. </Style>
  153. <!--登陆页面按钮样式结束-->
  154. <!--列车晚点表格的样式Start-->
  155. <Style x:Key="dataGridRowStyle_Lcwd" TargetType="DataGridRow">
  156. <Setter Property="Background" Value="White"/>
  157. <Setter Property="Foreground" Value="#0000FF"/>
  158. <Setter Property="VerticalAlignment" Value="Center" />
  159. <Setter Property="VerticalContentAlignment" Value="Center" />
  160. <!--<Setter Property="Height" Value="35"/>-->
  161. <Style.Triggers>
  162. <Trigger Property="IsMouseOver" Value="True">
  163. <Setter Property="Background" Value="#EEEEF2"/>
  164. </Trigger>
  165. <Trigger Property="IsSelected" Value="True">
  166. <Setter Property="Background" Value="#EDF1F2"/>
  167. <!--<Setter Property="Foreground" Value="Red" />-->
  168. </Trigger>
  169. </Style.Triggers>
  170. </Style>
  171. <Style x:Key="dataGridCellStyle_Lcwd" TargetType="DataGridCell">
  172. <Setter Property="BorderThickness" Value="0"/>
  173. <!--<Setter Property="MinWidth" Value="85"/>-->
  174. <Style.Triggers>
  175. <Trigger Property="IsSelected" Value="True">
  176. <Setter Property="Background" Value="#EDF1F2"/>
  177. <Setter Property="Foreground" Value="#0000FF"/>
  178. </Trigger>
  179. </Style.Triggers>
  180. </Style>
  181. <Style x:Key="contentCenterStyle" TargetType="{x:Type TextBlock}">
  182. <Setter Property="VerticalAlignment" Value="Center" />
  183. <Setter Property="Margin" Value="5,0,0,0" />
  184. </Style>
  185. <!--列车晚点表格的样式End-->
  186. <!--按钮样式开始-->
  187. <Style x:Key="MyWpfButton1" TargetType="{x:Type Button}" >
  188. <Setter Property="Background" Value="{StaticResource LinearGradientBlueBackground1}"></Setter>
  189. <Setter Property="Foreground" Value="#000000"></Setter>
  190. <Setter Property="BorderBrush" Value="{StaticResource MyBtnBorderColor1}"></Setter>
  191. <Setter Property="Template">
  192. <Setter.Value>
  193. <ControlTemplate TargetType="{x:Type Button}">
  194. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
  195. SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
  196. <ContentPresenter x:Name="contentPresenter"
  197. Focusable="False"
  198. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  199. Margin="{TemplateBinding Padding}"
  200. RecognizesAccessKey="True"
  201. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  202. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  203. </Border>
  204. <ControlTemplate.Triggers>
  205. <Trigger Property="IsMouseOver" Value="true">
  206. <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnHoverBackgroundColor1}"/>
  207. </Trigger>
  208. </ControlTemplate.Triggers>
  209. </ControlTemplate>
  210. </Setter.Value>
  211. </Setter>
  212. </Style>
  213. <!--按钮样式结束-->
  214. <!--自定义颜色-->
  215. <LinearGradientBrush x:Key="LinearGradientBlueBackground1" EndPoint="0.5,1" StartPoint="0.5,0">
  216. <GradientStop Color="#FFFFFFFF" Offset="0" />
  217. <GradientStop Color="#FFE6E6E6" Offset="1" />
  218. </LinearGradientBrush>
  219. <SolidColorBrush x:Key="MyBtnBorderColor1" Color="#FF4E4E4E"></SolidColorBrush>
  220. <SolidColorBrush x:Key="MyBtnHoverBackgroundColor1" Color="#FFE3E3E3"></SolidColorBrush>
  221. <!--END-->
  222. <Style x:Key="MyWpfButton2" TargetType="{x:Type Button}" >
  223. <Setter Property="Background" Value="{StaticResource LinearGradientBlueBackground1}"></Setter>
  224. <Setter Property="Foreground" Value="#000000"></Setter>
  225. <Setter Property="BorderBrush" Value="{StaticResource MyBtnBorderColor1}"></Setter>
  226. <Setter Property="Template">
  227. <Setter.Value>
  228. <ControlTemplate TargetType="{x:Type Button}">
  229. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
  230. SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
  231. <ContentPresenter x:Name="contentPresenter"
  232. Focusable="False"
  233. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  234. Margin="{TemplateBinding Padding}"
  235. RecognizesAccessKey="True"
  236. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  237. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  238. </Border>
  239. <ControlTemplate.Triggers>
  240. <Trigger Property="IsMouseOver" Value="true">
  241. <Setter Property="Background" TargetName="border" Value="{StaticResource MyBtnHoverBackgroundColor1}"/>
  242. </Trigger>
  243. </ControlTemplate.Triggers>
  244. </ControlTemplate>
  245. </Setter.Value>
  246. </Setter>
  247. </Style>
  248. <Style TargetType="DatePickerTextBox">
  249. <Setter Property="Control.Template">
  250. <Setter.Value>
  251. <ControlTemplate>
  252. <TextBox Text="{Binding Path=SelectedDate, StringFormat='yyyy-MM-dd', RelativeSource={RelativeSource AncestorType=DatePicker}}" />
  253. </ControlTemplate>
  254. </Setter.Value>
  255. </Setter>
  256. </Style>
  257. </ResourceDictionary>
  258. </Application.Resources>
  259. </Application>