選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

267 行
18 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. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ListView.xaml" />
  6. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/TreeView.xaml" />
  7. </ResourceDictionary.MergedDictionaries>
  8. <Style x:Key="RubyerTreeListViewScrollViewer"
  9. BasedOn="{StaticResource RubyerScrollViewer}"
  10. TargetType="ScrollViewer">
  11. <Setter Property="Template">
  12. <Setter.Value>
  13. <ControlTemplate TargetType="ScrollViewer">
  14. <Grid Background="{TemplateBinding Background}">
  15. <Grid.ColumnDefinitions>
  16. <ColumnDefinition Width="*" />
  17. <ColumnDefinition Width="Auto" />
  18. </Grid.ColumnDefinitions>
  19. <Grid.RowDefinitions>
  20. <RowDefinition Height="Auto" />
  21. <RowDefinition Height="*" />
  22. <RowDefinition Height="Auto" />
  23. </Grid.RowDefinitions>
  24. <ScrollViewer Grid.ColumnSpan="2"
  25. Margin="{TemplateBinding Padding}"
  26. DockPanel.Dock="Top"
  27. Focusable="False"
  28. HorizontalScrollBarVisibility="Hidden"
  29. VerticalScrollBarVisibility="Hidden">
  30. <!--<GridViewHeaderRowPresenter AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
  31. ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
  32. ColumnHeaderContextMenu="{Binding Path=TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
  33. ColumnHeaderTemplate="{Binding Path=TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
  34. ColumnHeaderTemplateSelector="{Binding Path=TemplatedParent.View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}"
  35. ColumnHeaderToolTip="{Binding Path=TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
  36. Columns="{Binding Path=TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
  37. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />-->
  38. <GridViewHeaderRowPresenter Columns="{Binding Path=Columns, RelativeSource={RelativeSource AncestorType=bpa:TreeListView}}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  39. </ScrollViewer>
  40. <ScrollContentPresenter Name="PART_ScrollContentPresenter"
  41. Grid.Row="1"
  42. CanContentScroll="True"
  43. CanHorizontallyScroll="False"
  44. CanVerticallyScroll="False"
  45. KeyboardNavigation.DirectionalNavigation="Local" />
  46. <ScrollBar Name="PART_HorizontalScrollBar"
  47. Style="{StaticResource RubyerScrollBar}"
  48. Grid.Row="2"
  49. Maximum="{TemplateBinding ScrollableWidth}"
  50. Orientation="Horizontal"
  51. ViewportSize="{TemplateBinding ViewportWidth}"
  52. Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
  53. Value="{TemplateBinding HorizontalOffset}" />
  54. <ScrollBar Name="PART_VerticalScrollBar"
  55. Style="{StaticResource RubyerScrollBar}"
  56. Grid.Row="1"
  57. Grid.Column="1"
  58. Maximum="{TemplateBinding ScrollableHeight}"
  59. ViewportSize="{TemplateBinding ViewportHeight}"
  60. Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  61. Value="{TemplateBinding VerticalOffset}" />
  62. </Grid>
  63. </ControlTemplate>
  64. </Setter.Value>
  65. </Setter>
  66. </Style>
  67. <Style x:Key="RubyerTreeListViewItem" TargetType="{x:Type bpa:TreeListViewItem}">
  68. <Setter Property="Background" Value="Transparent" />
  69. <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeView}}" />
  70. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  71. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  72. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  73. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  74. <Setter Property="Padding" Value="{Binding Path=(bpa:ItemsControlHelper.ItemPadding), RelativeSource={RelativeSource AncestorType=TreeView}}" />
  75. <Setter Property="Margin" Value="{Binding Path=(bpa:ItemsControlHelper.ItemMargin), RelativeSource={RelativeSource AncestorType=TreeView}}" />
  76. <Setter Property="Template">
  77. <Setter.Value>
  78. <ControlTemplate TargetType="{x:Type bpa:TreeListViewItem}">
  79. <Grid x:Name="root">
  80. <Grid.ColumnDefinitions>
  81. <ColumnDefinition Width="20" />
  82. <ColumnDefinition Width="*" />
  83. </Grid.ColumnDefinitions>
  84. <Grid.RowDefinitions>
  85. <RowDefinition Height="Auto" />
  86. <RowDefinition />
  87. </Grid.RowDefinitions>
  88. <ToggleButton x:Name="Expander"
  89. Style="{StaticResource ExpandCollapseToggleStyle}"
  90. ClickMode="Press"
  91. IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" />
  92. <bpa:ControlMask Grid.Column="1"
  93. Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TreeView}}"
  94. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=TreeView}}"
  95. IsActive="{TemplateBinding IsSelected}"
  96. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=TreeView}}" />
  97. <Border x:Name="Bd"
  98. Grid.Column="1"
  99. Padding="{TemplateBinding Padding}"
  100. Background="{TemplateBinding Background}"
  101. BorderBrush="{TemplateBinding BorderBrush}"
  102. BorderThickness="{TemplateBinding BorderThickness}"
  103. SnapsToDevicePixels="true">
  104. <bpa:TreeGridViewRowPresenter Margin="20 0 0 0"
  105. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  106. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  107. Columns="{Binding Columns, RelativeSource={RelativeSource AncestorType=bpa:TreeListView}}"
  108. Content="{TemplateBinding Header}"
  109. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  110. </Border>
  111. <bpa:Transition Grid.Row="1"
  112. Grid.Column="1"
  113. IsShow="{TemplateBinding IsExpanded}"
  114. Type="CollapseUp">
  115. <ItemsPresenter x:Name="ItemsHost"
  116. VerticalAlignment="Top"
  117. Opacity="0"
  118. Visibility="Collapsed" />
  119. </bpa:Transition>
  120. </Grid>
  121. <ControlTemplate.Triggers>
  122. <Trigger Property="IsExpanded" Value="True">
  123. <Trigger.EnterActions>
  124. <BeginStoryboard>
  125. <Storyboard>
  126. <DoubleAnimation Storyboard.TargetName="ItemsHost"
  127. Storyboard.TargetProperty="Opacity"
  128. To="1"
  129. Duration="0:0:0.3">
  130. <DoubleAnimation.EasingFunction>
  131. <CubicEase EasingMode="EaseOut" />
  132. </DoubleAnimation.EasingFunction>
  133. </DoubleAnimation>
  134. <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
  135. <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
  136. </ObjectAnimationUsingKeyFrames>
  137. </Storyboard>
  138. </BeginStoryboard>
  139. </Trigger.EnterActions>
  140. <Trigger.ExitActions>
  141. <BeginStoryboard>
  142. <Storyboard>
  143. <DoubleAnimation Storyboard.TargetName="ItemsHost"
  144. Storyboard.TargetProperty="Opacity"
  145. To="0"
  146. Duration="0:0:0.3">
  147. <DoubleAnimation.EasingFunction>
  148. <CubicEase EasingMode="EaseOut" />
  149. </DoubleAnimation.EasingFunction>
  150. </DoubleAnimation>
  151. <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
  152. <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}" />
  153. </ObjectAnimationUsingKeyFrames>
  154. </Storyboard>
  155. </BeginStoryboard>
  156. </Trigger.ExitActions>
  157. </Trigger>
  158. <Trigger Property="HasItems" Value="false">
  159. <Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
  160. </Trigger>
  161. <Trigger Property="IsEnabled" Value="false">
  162. <Setter Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  163. </Trigger>
  164. <Trigger Property="IsSelected" Value="True">
  165. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=TreeView}}" />
  166. </Trigger>
  167. </ControlTemplate.Triggers>
  168. </ControlTemplate>
  169. </Setter.Value>
  170. </Setter>
  171. <Style.Triggers>
  172. <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
  173. <Setter Property="ItemsPanel">
  174. <Setter.Value>
  175. <ItemsPanelTemplate>
  176. <VirtualizingStackPanel />
  177. </ItemsPanelTemplate>
  178. </Setter.Value>
  179. </Setter>
  180. </Trigger>
  181. </Style.Triggers>
  182. </Style>
  183. <Style x:Key="RubyerTreeListView" TargetType="{x:Type bpa:TreeListView}">
  184. <Setter Property="Background" Value="Transparent" />
  185. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  186. <Setter Property="BorderThickness" Value="0" />
  187. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  188. <Setter Property="VerticalContentAlignment" Value="Center" />
  189. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  190. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  191. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  192. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  193. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  194. <Setter Property="SnapsToDevicePixels" Value="True" />
  195. <Setter Property="ItemContainerStyle" Value="{StaticResource RubyerTreeListViewItem}" />
  196. <Setter Property="bpa:ControlHelper.CornerRadius" Value="0" />
  197. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Mask}" />
  198. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource DefaultForeground}" />
  199. <Setter Property="bpa:ControlHelper.CornerRadius" Value="0" />
  200. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="0.6" />
  201. <Setter Property="bpa:ItemsControlHelper.ItemMargin" Value="0" />
  202. <Setter Property="bpa:ItemsControlHelper.ItemPadding" Value="5" />
  203. <Setter Property="bpa:TreeViewHelper.IconFocusedBrush" Value="{DynamicResource Primary}" />
  204. <Setter Property="bpa:TreeViewHelper.RightClickToSelected" Value="True" />
  205. <Setter Property="bpa:TreeViewHelper.IsBindable" Value="True" />
  206. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource HeaderBackground}" />
  207. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource BlackForeground}" />
  208. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  209. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  210. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Center" />
  211. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Top" />
  212. <Setter Property="bpa:HeaderHelper.Padding" Value="5" />
  213. <Setter Property="Template">
  214. <Setter.Value>
  215. <ControlTemplate TargetType="{x:Type bpa:TreeListView}">
  216. <Border x:Name="Bd"
  217. BorderBrush="{TemplateBinding BorderBrush}"
  218. BorderThickness="{TemplateBinding BorderThickness}"
  219. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  220. <ScrollViewer x:Name="_tv_scrollviewer_"
  221. Style="{StaticResource RubyerTreeListViewScrollViewer}"
  222. Padding="{TemplateBinding Padding}"
  223. Background="{TemplateBinding Background}"
  224. CanContentScroll="false"
  225. Focusable="false"
  226. HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
  227. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  228. VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
  229. <ItemsPresenter x:Name="items" OverridesDefaultStyle="True" />
  230. </ScrollViewer>
  231. </Border>
  232. <ControlTemplate.Triggers>
  233. <Trigger Property="IsEnabled" Value="False">
  234. <Setter TargetName="Bd" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  235. </Trigger>
  236. <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="True">
  237. <Setter TargetName="_tv_scrollviewer_" Property="CanContentScroll" Value="True" />
  238. </Trigger>
  239. </ControlTemplate.Triggers>
  240. </ControlTemplate>
  241. </Setter.Value>
  242. </Setter>
  243. <Style.Triggers>
  244. <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="True">
  245. <Setter Property="ItemsPanel">
  246. <Setter.Value>
  247. <ItemsPanelTemplate>
  248. <VirtualizingStackPanel />
  249. </ItemsPanelTemplate>
  250. </Setter.Value>
  251. </Setter>
  252. </Trigger>
  253. </Style.Triggers>
  254. </Style>
  255. </ResourceDictionary>