You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

631 lines
42 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl"
  4. xmlns:converters="clr-namespace:BPA.UIControl.Converters">
  5. <ResourceDictionary.MergedDictionaries>
  6. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ScrollViewer.xaml" />
  7. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/CheckBox.xaml" />
  8. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ComboBox.xaml" />
  9. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ToggleButton.xaml" />
  10. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Loading.xaml" />
  11. </ResourceDictionary.MergedDictionaries>
  12. <!-- Style and template for the DataGridCell. -->
  13. <Style x:Key="RubyerDataGridCell" TargetType="{x:Type DataGridCell}">
  14. <Setter Property="BorderThickness" Value="0" />
  15. <Setter Property="Padding" Value="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  16. <Setter Property="Template">
  17. <Setter.Value>
  18. <ControlTemplate TargetType="{x:Type DataGridCell}">
  19. <Grid>
  20. <bpa:ControlMask x:Name="mask"
  21. Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  22. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  23. IsActive="{TemplateBinding IsSelected}"
  24. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  25. Visibility="Visible" />
  26. <Border x:Name="border"
  27. Background="Transparent"
  28. BorderBrush="{TemplateBinding BorderBrush}"
  29. BorderThickness="{TemplateBinding BorderThickness}"
  30. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  31. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  32. <ContentPresenter Margin="{TemplateBinding Padding}"
  33. HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  34. VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  35. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  36. </Border>
  37. </Grid>
  38. <ControlTemplate.Triggers>
  39. <Trigger Property="IsSelected" Value="True">
  40. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  41. </Trigger>
  42. <DataTrigger Binding="{Binding SelectionUnit, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="FullRow">
  43. <Setter TargetName="mask" Property="Visibility" Value="Collapsed" />
  44. </DataTrigger>
  45. </ControlTemplate.Triggers>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. <!-- Style and template for the resize control on the DataGridRowHeader. -->
  51. <Style x:Key="RowHeaderGripperStyle" TargetType="{x:Type Thumb}">
  52. <Setter Property="Height" Value="5" />
  53. <Setter Property="Background" Value="Transparent" />
  54. <Setter Property="Cursor" Value="SizeNS" />
  55. <Setter Property="Template">
  56. <Setter.Value>
  57. <ControlTemplate TargetType="{x:Type Thumb}">
  58. <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
  59. </ControlTemplate>
  60. </Setter.Value>
  61. </Setter>
  62. </Style>
  63. <!-- Style and template for the DataGridRowHeader. -->
  64. <Style x:Key="RubyerDataGridRowHeader" TargetType="{x:Type DataGridRowHeader}">
  65. <Setter Property="SnapsToDevicePixels" Value="True" />
  66. <Setter Property="BorderBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  67. <Setter Property="BorderThickness" Value="0" />
  68. <Setter Property="Background" Value="Transparent" />
  69. <Setter Property="Template">
  70. <Setter.Value>
  71. <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
  72. <Grid>
  73. <Border x:Name="rowHeaderBorder"
  74. Background="{TemplateBinding Background}"
  75. BorderBrush="{TemplateBinding BorderBrush}"
  76. BorderThickness="{TemplateBinding BorderThickness}">
  77. <StackPanel Margin="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  78. HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  79. VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  80. Orientation="Horizontal">
  81. <Control Margin="0 0 3 0"
  82. SnapsToDevicePixels="False"
  83. Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"
  84. Visibility="{Binding Path=(Validation.HasError), Converter={StaticResource BooleanToVisibleConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
  85. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  86. </StackPanel>
  87. </Border>
  88. <Thumb x:Name="PART_TopHeaderGripper"
  89. Style="{StaticResource RowHeaderGripperStyle}"
  90. VerticalAlignment="Top" />
  91. <Thumb x:Name="PART_BottomHeaderGripper"
  92. Style="{StaticResource RowHeaderGripperStyle}"
  93. VerticalAlignment="Bottom" />
  94. </Grid>
  95. <ControlTemplate.Triggers>
  96. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="All">
  97. <Setter Property="BorderThickness" Value="0 0 1 1" />
  98. </DataTrigger>
  99. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Vertical">
  100. <Setter Property="BorderThickness" Value="0 0 1 0" />
  101. </DataTrigger>
  102. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Horizontal">
  103. <Setter Property="BorderThickness" Value="0 0 0 1" />
  104. </DataTrigger>
  105. </ControlTemplate.Triggers>
  106. </ControlTemplate>
  107. </Setter.Value>
  108. </Setter>
  109. </Style>
  110. <!-- Style and template for the DataGridRow. -->
  111. <Style x:Key="RubyerDataGridRow" TargetType="{x:Type DataGridRow}">
  112. <Setter Property="Background" Value="Transparent" />
  113. <Setter Property="BorderBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  114. <Setter Property="BorderThickness" Value="0" />
  115. <Setter Property="SnapsToDevicePixels" Value="True" />
  116. <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
  117. <Setter Property="DetailsVisibility" Value="Collapsed" />
  118. <Setter Property="Template">
  119. <Setter.Value>
  120. <ControlTemplate TargetType="{x:Type DataGridRow}">
  121. <Border x:Name="DGR_Border"
  122. Background="{TemplateBinding Background}"
  123. BorderBrush="{TemplateBinding BorderBrush}"
  124. BorderThickness="{TemplateBinding BorderThickness}"
  125. SnapsToDevicePixels="True">
  126. <Grid>
  127. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  128. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=DataGrid}}"
  129. IsActive="{TemplateBinding IsSelected}"
  130. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  131. <SelectiveScrollingGrid>
  132. <SelectiveScrollingGrid.ColumnDefinitions>
  133. <ColumnDefinition Width="Auto" />
  134. <ColumnDefinition Width="*" />
  135. </SelectiveScrollingGrid.ColumnDefinitions>
  136. <SelectiveScrollingGrid.RowDefinitions>
  137. <RowDefinition Height="*" />
  138. <RowDefinition Height="Auto" />
  139. </SelectiveScrollingGrid.RowDefinitions>
  140. <DataGridRowHeader Grid.RowSpan="2"
  141. SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
  142. Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
  143. <DataGridCellsPresenter Grid.Column="1"
  144. ItemsPanel="{TemplateBinding ItemsPanel}"
  145. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  146. <bpa:Transition Grid.Row="1"
  147. Grid.Column="1"
  148. IsShow="{TemplateBinding DetailsVisibility, Converter={StaticResource VisibilityToBooleanConverter}}"
  149. Type="CollapseUp">
  150. <DataGridDetailsPresenter SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
  151. </bpa:Transition>
  152. </SelectiveScrollingGrid>
  153. </Grid>
  154. </Border>
  155. <ControlTemplate.Triggers>
  156. <Trigger Property="IsSelected" Value="True">
  157. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  158. </Trigger>
  159. </ControlTemplate.Triggers>
  160. </ControlTemplate>
  161. </Setter.Value>
  162. </Setter>
  163. </Style>
  164. <!-- Style and template for the resize control on the DataGridColumnHeader. -->
  165. <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
  166. <Setter Property="Background" Value="Transparent" />
  167. <Setter Property="Cursor" Value="SizeWE" />
  168. <Setter Property="Width" Value="5" />
  169. <Setter Property="Template">
  170. <Setter.Value>
  171. <ControlTemplate TargetType="{x:Type Thumb}">
  172. <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
  173. </ControlTemplate>
  174. </Setter.Value>
  175. </Setter>
  176. </Style>
  177. <!-- Style and template for the DataGridColumnHeader. -->
  178. <Style x:Key="RubyerDataGridColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
  179. <Setter Property="Background" Value="Transparent" />
  180. <Setter Property="Foreground" Value="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  181. <Setter Property="HorizontalContentAlignment" Value="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  182. <Setter Property="VerticalContentAlignment" Value="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  183. <Setter Property="Padding" Value="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  184. <Setter Property="FontSize" Value="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  185. <Setter Property="FontWeight" Value="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  186. <Setter Property="FontFamily" Value="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  187. <Setter Property="Template">
  188. <Setter.Value>
  189. <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
  190. <Grid>
  191. <Border x:Name="columnHeaderBorder"
  192. Padding="{TemplateBinding Padding}"
  193. Background="{TemplateBinding Background}"
  194. BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  195. BorderThickness="0">
  196. <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  197. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  198. Orientation="Horizontal">
  199. <ContentPresenter Grid.Column="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  200. <bpa:Icon x:Name="arrow"
  201. Foreground="{TemplateBinding Foreground}"
  202. RenderTransformOrigin="0.5,0.5"
  203. Type="ArrowDownSLine"
  204. Visibility="Collapsed">
  205. <bpa:Icon.RenderTransform>
  206. <RotateTransform x:Name="arrowTransform" Angle="0" />
  207. </bpa:Icon.RenderTransform>
  208. </bpa:Icon>
  209. </StackPanel>
  210. </Border>
  211. <Thumb x:Name="PART_LeftHeaderGripper"
  212. Style="{StaticResource ColumnHeaderGripperStyle}"
  213. HorizontalAlignment="Left" />
  214. <Thumb x:Name="PART_RightHeaderGripper"
  215. Style="{StaticResource ColumnHeaderGripperStyle}"
  216. HorizontalAlignment="Right" />
  217. </Grid>
  218. <ControlTemplate.Triggers>
  219. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Vertical">
  220. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 0" />
  221. </DataTrigger>
  222. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Horizontal">
  223. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 0 1" />
  224. </DataTrigger>
  225. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="All">
  226. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 1" />
  227. </DataTrigger>
  228. <DataTrigger Binding="{Binding SortDirection, RelativeSource={RelativeSource Self}}" Value="Descending">
  229. <Setter TargetName="arrow" Property="Visibility" Value="Visible" />
  230. </DataTrigger>
  231. <DataTrigger Binding="{Binding SortDirection, RelativeSource={RelativeSource Self}}" Value="Ascending">
  232. <Setter TargetName="arrow" Property="Visibility" Value="Visible" />
  233. <DataTrigger.EnterActions>
  234. <BeginStoryboard>
  235. <Storyboard>
  236. <DoubleAnimation Storyboard.TargetName="arrowTransform"
  237. Storyboard.TargetProperty="Angle"
  238. From="0"
  239. To="180"
  240. Duration="0:0:0.3" />
  241. </Storyboard>
  242. </BeginStoryboard>
  243. </DataTrigger.EnterActions>
  244. <DataTrigger.ExitActions>
  245. <BeginStoryboard>
  246. <Storyboard>
  247. <DoubleAnimation Storyboard.TargetName="arrowTransform"
  248. Storyboard.TargetProperty="Angle"
  249. To="0"
  250. Duration="0:0:0.3" />
  251. </Storyboard>
  252. </BeginStoryboard>
  253. </DataTrigger.ExitActions>
  254. </DataTrigger>
  255. </ControlTemplate.Triggers>
  256. </ControlTemplate>
  257. </Setter.Value>
  258. </Setter>
  259. </Style>
  260. <Style x:Key="FirstDataGridColumnHeader"
  261. BasedOn="{StaticResource RubyerDataGridColumnHeader}"
  262. TargetType="{x:Type DataGridColumnHeader}">
  263. <Setter Property="Background" Value="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  264. <Setter Property="Template">
  265. <Setter.Value>
  266. <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
  267. <Border x:Name="columnHeaderBorder"
  268. Padding="{TemplateBinding Padding}"
  269. Background="{TemplateBinding Background}"
  270. BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=DataGrid}}">
  271. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  272. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  273. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  274. </Border>
  275. <ControlTemplate.Triggers>
  276. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Vertical">
  277. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 0" />
  278. </DataTrigger>
  279. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Horizontal">
  280. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 0 1" />
  281. </DataTrigger>
  282. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="All">
  283. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 1" />
  284. </DataTrigger>
  285. </ControlTemplate.Triggers>
  286. </ControlTemplate>
  287. </Setter.Value>
  288. </Setter>
  289. </Style>
  290. <converters:GetDataGridColumnCheckedContentConverter x:Key="GetDataGridColumnCheckedContent" />
  291. <Style x:Key="DataGridSelectCheckBoxColumnHeader"
  292. BasedOn="{StaticResource RubyerDataGridColumnHeader}"
  293. TargetType="{x:Type DataGridColumnHeader}">
  294. <Setter Property="Background" Value="Transparent" />
  295. <Setter Property="Template">
  296. <Setter.Value>
  297. <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
  298. <Border x:Name="columnHeaderBorder"
  299. Padding="{TemplateBinding Padding}"
  300. Background="{TemplateBinding Background}"
  301. BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  302. BorderThickness="0">
  303. <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  304. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  305. Orientation="Horizontal">
  306. <CheckBox bpa:DataGridHelper.IsHeaderSelectCheckBox="True"
  307. Content="{TemplateBinding Content}"
  308. Foreground="{TemplateBinding Foreground}">
  309. <bpa:ToggleButtonHelper.CheckedContent>
  310. <MultiBinding Converter="{StaticResource GetDataGridColumnCheckedContent}" Mode="OneWay">
  311. <Binding RelativeSource="{RelativeSource AncestorType=DataGrid}" />
  312. <Binding RelativeSource="{RelativeSource AncestorType=DataGridColumnHeader}" />
  313. </MultiBinding>
  314. </bpa:ToggleButtonHelper.CheckedContent>
  315. </CheckBox>
  316. </StackPanel>
  317. </Border>
  318. <ControlTemplate.Triggers>
  319. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Vertical">
  320. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 0" />
  321. </DataTrigger>
  322. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Horizontal">
  323. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 0 1" />
  324. </DataTrigger>
  325. <DataTrigger Binding="{Binding GridLinesVisibility, RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="All">
  326. <Setter TargetName="columnHeaderBorder" Property="BorderThickness" Value="0 0 1 1" />
  327. </DataTrigger>
  328. </ControlTemplate.Triggers>
  329. </ControlTemplate>
  330. </Setter.Value>
  331. </Setter>
  332. </Style>
  333. <!-- Style and template for the DataGridColumnHeadersPresenter. -->
  334. <Style x:Key="RubyerDataGridColumnHeadersPresenter" TargetType="{x:Type DataGridColumnHeadersPresenter}">
  335. <Setter Property="Background" Value="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  336. <Setter Property="Template">
  337. <Setter.Value>
  338. <ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">
  339. <Grid Background="{TemplateBinding Background}">
  340. <DataGridColumnHeader x:Name="PART_FillerColumnHeader" IsHitTestVisible="False" />
  341. <ItemsPresenter />
  342. </Grid>
  343. </ControlTemplate>
  344. </Setter.Value>
  345. </Setter>
  346. </Style>
  347. <bpa:Icon x:Key="DataGridRowHeaderTitleIcon"
  348. x:Shared="False"
  349. Type="GridFill" />
  350. <!-- Style and template for the DataGrid. -->
  351. <Style x:Key="RubyerDataGrid" TargetType="{x:Type DataGrid}">
  352. <Setter Property="Background" Value="Transparent" />
  353. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  354. <Setter Property="BorderThickness" Value="0" />
  355. <Setter Property="CellStyle" Value="{StaticResource RubyerDataGridCell}" />
  356. <Setter Property="ColumnHeaderStyle" Value="{StaticResource RubyerDataGridColumnHeader}" />
  357. <Setter Property="RowHeaderStyle" Value="{StaticResource RubyerDataGridRowHeader}" />
  358. <Setter Property="RowStyle" Value="{StaticResource RubyerDataGridRow}" />
  359. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  360. <Setter Property="GridLinesVisibility" Value="Horizontal" />
  361. <Setter Property="HeadersVisibility" Value="Column" />
  362. <Setter Property="HorizontalContentAlignment" Value="Left" />
  363. <Setter Property="HorizontalGridLinesBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource Self}}" />
  364. <Setter Property="VerticalGridLinesBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource Self}}" />
  365. <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
  366. <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
  367. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  368. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  369. <Setter Property="VerticalContentAlignment" Value="Center" />
  370. <Setter Property="RowDetailsVisibilityMode" Value="Collapsed" />
  371. <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MouseOverValidationErrorTemplate}" />
  372. <Setter Property="bpa:ControlHelper.CornerRadius" Value="0" />
  373. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="0.6" />
  374. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Mask}" />
  375. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource DefaultForeground}" />
  376. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource HeaderBackground}" />
  377. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  378. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  379. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Bold" />
  380. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Left" />
  381. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Center" />
  382. <Setter Property="bpa:HeaderHelper.Padding" Value="10 8" />
  383. <Setter Property="bpa:ItemsControlHelper.ItemPadding" Value="5" />
  384. <Setter Property="bpa:DataGridHelper.ApplyColumnElementStyle" Value="True" />
  385. <Setter Property="bpa:DataGridHelper.ClickToEdit" Value="True" />
  386. <Setter Property="bpa:DataGridHelper.ApplyDataAnnotations" Value="True" />
  387. <Setter Property="bpa:DataGridHelper.LoadingContent" Value="{DynamicResource I18N_DataGrid_LoadingContent}" />
  388. <Setter Property="bpa:DataGridHelper.EmptyView">
  389. <Setter.Value>
  390. <StackPanel HorizontalAlignment="Center"
  391. VerticalAlignment="Center"
  392. Orientation="Horizontal">
  393. <bpa:Icon Margin="5 0" Type="DatabaseFill" />
  394. <TextBlock Text="{DynamicResource I18N_DataGrid_NoData}" />
  395. </StackPanel>
  396. </Setter.Value>
  397. </Setter>
  398. <Setter Property="bpa:DataGridHelper.RowHeaderTitle" Value="{StaticResource DataGridRowHeaderTitleIcon}" />
  399. <Setter Property="Template">
  400. <Setter.Value>
  401. <ControlTemplate TargetType="{x:Type DataGrid}">
  402. <Border x:Name="border"
  403. Padding="{TemplateBinding Padding}"
  404. Background="{TemplateBinding Background}"
  405. BorderBrush="{TemplateBinding BorderBrush}"
  406. BorderThickness="{TemplateBinding BorderThickness}"
  407. SnapsToDevicePixels="True">
  408. <ScrollViewer x:Name="DG_ScrollViewer"
  409. Style="{StaticResource RubyerScrollViewer}"
  410. Background="Transparent"
  411. Focusable="False">
  412. <ScrollViewer.Template>
  413. <ControlTemplate TargetType="{x:Type ScrollViewer}">
  414. <Grid x:Name="root">
  415. <Grid.ColumnDefinitions>
  416. <ColumnDefinition Width="Auto" />
  417. <ColumnDefinition Width="*" />
  418. <ColumnDefinition Width="Auto" />
  419. </Grid.ColumnDefinitions>
  420. <Grid.RowDefinitions>
  421. <RowDefinition Height="Auto" />
  422. <RowDefinition Height="*" />
  423. <RowDefinition Height="Auto" />
  424. </Grid.RowDefinitions>
  425. <DataGridColumnHeader Style="{StaticResource FirstDataGridColumnHeader}"
  426. Width="{Binding RowHeaderActualWidth, RelativeSource={RelativeSource AncestorType=DataGrid}}"
  427. Command="DataGrid.SelectAllCommand"
  428. Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}">
  429. <ContentControl Content="{Binding Path=(bpa:DataGridHelper.RowHeaderTitle), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  430. </DataGridColumnHeader>
  431. <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
  432. Style="{StaticResource RubyerDataGridColumnHeadersPresenter}"
  433. Grid.Column="1"
  434. Grid.ColumnSpan="2"
  435. Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
  436. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
  437. Grid.Row="1"
  438. Grid.RowSpan="2"
  439. Grid.ColumnSpan="3"
  440. CanContentScroll="{TemplateBinding CanContentScroll}" />
  441. <ScrollBar x:Name="PART_VerticalScrollBar"
  442. Style="{StaticResource RubyerScrollBar}"
  443. Grid.Row="1"
  444. Grid.Column="2"
  445. Maximum="{TemplateBinding ScrollableHeight}"
  446. Orientation="Vertical"
  447. ViewportSize="{TemplateBinding ViewportHeight}"
  448. Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  449. Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
  450. <ScrollBar x:Name="PART_HorizontalScrollBar"
  451. Style="{StaticResource RubyerScrollBar}"
  452. Grid.Row="2"
  453. Grid.ColumnSpan="2"
  454. Maximum="{TemplateBinding ScrollableWidth}"
  455. Orientation="Horizontal"
  456. ViewportSize="{TemplateBinding ViewportWidth}"
  457. Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
  458. Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
  459. <Border x:Name="emptyBorder"
  460. Grid.Row="1"
  461. Grid.ColumnSpan="3"
  462. Visibility="Collapsed">
  463. <ContentControl x:Name="emptyView" Content="{Binding Path=(bpa:DataGridHelper.EmptyView), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  464. </Border>
  465. <Border x:Name="loadingBorder"
  466. Grid.Row="1"
  467. Grid.ColumnSpan="3"
  468. Background="{DynamicResource DialogBackground}"
  469. Visibility="Collapsed">
  470. <bpa:Card Padding="10"
  471. HorizontalAlignment="Center"
  472. VerticalAlignment="Center">
  473. <bpa:Loading x:Name="loading"
  474. Background="Transparent"
  475. Content="{Binding Path=(bpa:DataGridHelper.LoadingContent), RelativeSource={RelativeSource AncestorType=DataGrid}}" />
  476. </bpa:Card>
  477. </Border>
  478. </Grid>
  479. <ControlTemplate.Triggers>
  480. <DataTrigger Binding="{Binding Items.Count, RelativeSource={RelativeSource Mode=TemplatedParent}}" Value="0">
  481. <Setter TargetName="emptyBorder" Property="Visibility" Value="Visible" />
  482. </DataTrigger>
  483. <DataTrigger Binding="{Binding Path=(bpa:DataGridHelper.Loading), RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="True">
  484. <Setter TargetName="loadingBorder" Property="Visibility" Value="Visible" />
  485. </DataTrigger>
  486. </ControlTemplate.Triggers>
  487. </ControlTemplate>
  488. </ScrollViewer.Template>
  489. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  490. </ScrollViewer>
  491. </Border>
  492. </ControlTemplate>
  493. </Setter.Value>
  494. </Setter>
  495. <Style.Triggers>
  496. <Trigger Property="IsGrouping" Value="True">
  497. <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
  498. </Trigger>
  499. <Trigger Property="IsEnabled" Value="False">
  500. <Setter Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  501. </Trigger>
  502. </Style.Triggers>
  503. </Style>
  504. <Style x:Key="RubyerDataGridTextColumn"
  505. BasedOn="{StaticResource RubyerTextBox}"
  506. TargetType="{x:Type TextBox}">
  507. <Setter Property="Padding" Value="0 2" />
  508. </Style>
  509. <Style x:Key="RubyerDataGridCheckBoxColumn"
  510. BasedOn="{StaticResource RubyerCheckBox}"
  511. TargetType="{x:Type CheckBox}">
  512. <Setter Property="Focusable" Value="False" />
  513. <Setter Property="HorizontalAlignment" Value="Center" />
  514. <Setter Property="IsHitTestVisible" Value="False" />
  515. </Style>
  516. <Style x:Key="RubyerDataGridCheckBoxColumnEditting"
  517. BasedOn="{StaticResource RubyerCheckBox}"
  518. TargetType="{x:Type CheckBox}">
  519. <Setter Property="HorizontalAlignment" Value="Center" />
  520. </Style>
  521. <Style x:Key="RubyerDataGridComboBoxColumnEditting"
  522. BasedOn="{StaticResource RubyerComboBox}"
  523. TargetType="{x:Type ComboBox}">
  524. <Setter Property="Padding" Value="0 3" />
  525. </Style>
  526. <Style x:Key="RubyerDataGridDetailToggleButtonColumn" TargetType="{x:Type ToggleButton}">
  527. <Setter Property="Focusable" Value="False" />
  528. <Setter Property="HorizontalAlignment" Value="Center" />
  529. <Setter Property="IsHitTestVisible" Value="False" />
  530. <Setter Property="BorderThickness" Value="0" />
  531. <Setter Property="Background" Value="Transparent" />
  532. <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=DataGridCell}}" />
  533. <Setter Property="HorizontalContentAlignment" Value="Center" />
  534. <Setter Property="Padding" Value="5 0" />
  535. <Setter Property="SnapsToDevicePixels" Value="True" />
  536. <Setter Property="VerticalContentAlignment" Value="Center" />
  537. <Setter Property="IsChecked" Value="{Binding DetailsVisibility, RelativeSource={RelativeSource AncestorType=DataGridRow}, Converter={StaticResource VisibilityToBooleanConverter}}" />
  538. <Setter Property="Template">
  539. <Setter.Value>
  540. <ControlTemplate TargetType="{x:Type ToggleButton}">
  541. <Border x:Name="border"
  542. Background="{TemplateBinding Background}"
  543. BorderBrush="{TemplateBinding BorderBrush}"
  544. BorderThickness="{TemplateBinding BorderThickness}"
  545. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  546. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  547. <bpa:Icon RenderTransformOrigin="0.5 0.5" Type="ArrowDownSLine">
  548. <bpa:Icon.RenderTransform>
  549. <RotateTransform x:Name="arrowTransform" Angle="0" />
  550. </bpa:Icon.RenderTransform>
  551. </bpa:Icon>
  552. </Border>
  553. <ControlTemplate.Triggers>
  554. <Trigger Property="IsEnabled" Value="false">
  555. <Setter Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  556. </Trigger>
  557. <Trigger Property="IsChecked" Value="True">
  558. <Trigger.EnterActions>
  559. <BeginStoryboard>
  560. <Storyboard>
  561. <DoubleAnimation Storyboard.TargetName="arrowTransform"
  562. Storyboard.TargetProperty="Angle"
  563. To="-180"
  564. Duration="0:0:0.25">
  565. <DoubleAnimation.EasingFunction>
  566. <CubicEase EasingMode="EaseOut" />
  567. </DoubleAnimation.EasingFunction>
  568. </DoubleAnimation>
  569. </Storyboard>
  570. </BeginStoryboard>
  571. </Trigger.EnterActions>
  572. <Trigger.ExitActions>
  573. <BeginStoryboard>
  574. <Storyboard>
  575. <DoubleAnimation Storyboard.TargetName="arrowTransform"
  576. Storyboard.TargetProperty="Angle"
  577. To="0"
  578. Duration="0:0:0.25">
  579. <DoubleAnimation.EasingFunction>
  580. <CubicEase EasingMode="EaseOut" />
  581. </DoubleAnimation.EasingFunction>
  582. </DoubleAnimation>
  583. </Storyboard>
  584. </BeginStoryboard>
  585. </Trigger.ExitActions>
  586. </Trigger>
  587. </ControlTemplate.Triggers>
  588. </ControlTemplate>
  589. </Setter.Value>
  590. </Setter>
  591. </Style>
  592. </ResourceDictionary>