ListViewStyle.xaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <Style x:Key="FilesListViewStyle" TargetType="{x:Type ListView}">
  3. <Setter Property="Template">
  4. <Setter.Value>
  5. <ControlTemplate TargetType="{x:Type ListView}">
  6. <Border
  7. x:Name="Bd"
  8. Padding="1"
  9. Background="{TemplateBinding Background}"
  10. BorderBrush="{TemplateBinding BorderBrush}"
  11. BorderThickness="{TemplateBinding BorderThickness}"
  12. SnapsToDevicePixels="true">
  13. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  14. <Grid>
  15. <Grid.RowDefinitions>
  16. <RowDefinition Height="Auto" />
  17. <RowDefinition />
  18. </Grid.RowDefinitions>
  19. <Grid>
  20. <Grid.ColumnDefinitions>
  21. <ColumnDefinition Width="4.5*" MinWidth="0" />
  22. <ColumnDefinition Width="3*" />
  23. <ColumnDefinition Width="2*" />
  24. <ColumnDefinition Width="100" />
  25. </Grid.ColumnDefinitions>
  26. <TextBlock
  27. Margin="12,0,0,6"
  28. HorizontalAlignment="Left"
  29. VerticalAlignment="Center"
  30. FontSize="14" />
  31. <!-- Text="{x:Static homePageUI:HomePage.RencentFiles_Name}" -->
  32. <TextBlock
  33. Grid.Column="1"
  34. Margin="0,0,0,6"
  35. HorizontalAlignment="Center"
  36. VerticalAlignment="Center"
  37. FontSize="14"
  38. TextAlignment="Center"
  39. TextWrapping="Wrap" />
  40. <!-- Text="{x:Static homePageUI:HomePage.RencentFiles_LastOpenedTime}" -->
  41. <TextBlock
  42. Grid.Column="2"
  43. Margin="0,0,0,6"
  44. HorizontalAlignment="Center"
  45. VerticalAlignment="Center"
  46. FontSize="14" />
  47. <!-- Text="{x:Static homePageUI:HomePage.RencentFiles_Size}" -->
  48. <Rectangle
  49. Grid.ColumnSpan="4"
  50. Height="1"
  51. Margin="12,0,0,0"
  52. HorizontalAlignment="Stretch"
  53. VerticalAlignment="Bottom"
  54. Fill="#26000000" />
  55. </Grid>
  56. <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  57. </Grid>
  58. </ScrollViewer>
  59. </Border>
  60. </ControlTemplate>
  61. </Setter.Value>
  62. </Setter>
  63. </Style>
  64. <Style x:Key="FilesListViewItemStyle" TargetType="{x:Type ListViewItem}">
  65. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  66. <!--<Setter Property="Control.Padding" Value="4,1" />
  67. <Setter Property="Control.HorizontalContentAlignment">
  68. <Setter.Value>
  69. <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  70. </Setter.Value>
  71. </Setter>
  72. <Setter Property="Control.VerticalContentAlignment">
  73. <Setter.Value>
  74. <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  75. </Setter.Value>
  76. </Setter>-->
  77. <Setter Property="Panel.Background" Value="#00FFFFFF" />
  78. <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
  79. <Setter Property="Border.BorderThickness" Value="1" />
  80. <Setter Property="FrameworkElement.FocusVisualStyle">
  81. <Setter.Value>
  82. <Style TargetType="{x:Type IFrameworkInputElement}">
  83. <Setter Property="Control.Template">
  84. <Setter.Value>
  85. <ControlTemplate>
  86. <Rectangle
  87. Margin="2"
  88. SnapsToDevicePixels="True"
  89. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  90. StrokeDashArray="1 2"
  91. StrokeThickness="1" />
  92. </ControlTemplate>
  93. </Setter.Value>
  94. </Setter>
  95. </Style>
  96. </Setter.Value>
  97. </Setter>
  98. <Setter Property="Control.Template">
  99. <Setter.Value>
  100. <ControlTemplate TargetType="{x:Type ListViewItem}">
  101. <Border
  102. Name="Bd"
  103. Padding="{TemplateBinding Control.Padding}"
  104. Background="{TemplateBinding Panel.Background}"
  105. BorderBrush="{TemplateBinding Border.BorderBrush}"
  106. BorderThickness="{TemplateBinding Border.BorderThickness}"
  107. SnapsToDevicePixels="True">
  108. <Grid>
  109. <Grid.ColumnDefinitions>
  110. <ColumnDefinition Width="Auto" />
  111. <ColumnDefinition />
  112. </Grid.ColumnDefinitions>
  113. <Grid
  114. x:Name="SelectedIcon"
  115. Margin="12.5,0,0.5,0"
  116. HorizontalAlignment="Left"
  117. VerticalAlignment="Center"
  118. Visibility="Collapsed">
  119. <Rectangle
  120. x:Name="Selectedrect"
  121. Width="20"
  122. Height="20"
  123. HorizontalAlignment="Right"
  124. VerticalAlignment="Top"
  125. Fill="#FF477EDE" />
  126. <Path
  127. x:Name="MultiSelectCheck"
  128. Width="15"
  129. Height="15"
  130. Margin="0,1,0,0"
  131. HorizontalAlignment="Center"
  132. VerticalAlignment="Center"
  133. Data="M15.3493 0.596191L16.0564 1.3033L5.44979 11.9099L0.146484 6.6066L0.853591 5.89949L5.45004 10.496L15.3493 0.596191Z"
  134. Fill="White" />
  135. </Grid>
  136. <ContentPresenter
  137. Grid.Column="1"
  138. Margin="15,0,0,0"
  139. HorizontalAlignment="Stretch"
  140. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  141. Content="{TemplateBinding ContentControl.Content}"
  142. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  143. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  144. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  145. </Grid>
  146. </Border>
  147. <ControlTemplate.Triggers>
  148. <MultiTrigger>
  149. <MultiTrigger.Conditions>
  150. <Condition Property="UIElement.IsMouseOver" Value="True" />
  151. </MultiTrigger.Conditions>
  152. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A000000" />
  153. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />
  154. </MultiTrigger>
  155. <MultiTrigger>
  156. <MultiTrigger.Conditions>
  157. <Condition Property="Selector.IsSelectionActive" Value="False" />
  158. <Condition Property="Selector.IsSelected" Value="True" />
  159. </MultiTrigger.Conditions>
  160. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  161. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  162. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  163. </MultiTrigger>
  164. <MultiTrigger>
  165. <MultiTrigger.Conditions>
  166. <Condition Property="Selector.IsSelectionActive" Value="True" />
  167. <Condition Property="Selector.IsSelected" Value="True" />
  168. </MultiTrigger.Conditions>
  169. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  170. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  171. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  172. </MultiTrigger>
  173. <Trigger Property="UIElement.IsEnabled" Value="False">
  174. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  175. </Trigger>
  176. </ControlTemplate.Triggers>
  177. </ControlTemplate>
  178. </Setter.Value>
  179. </Setter>
  180. </Style>
  181. <Style x:Key="FilesGridItemStyle" TargetType="{x:Type ListViewItem}">
  182. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  183. <!--<Setter Property="Control.Padding" Value="4,1" />
  184. <Setter Property="Control.HorizontalContentAlignment">
  185. <Setter.Value>
  186. <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  187. </Setter.Value>
  188. </Setter>
  189. <Setter Property="Control.VerticalContentAlignment">
  190. <Setter.Value>
  191. <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  192. </Setter.Value>
  193. </Setter>-->
  194. <Setter Property="Panel.Background" Value="#00FFFFFF" />
  195. <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
  196. <Setter Property="Border.BorderThickness" Value="2" />
  197. <Setter Property="FrameworkElement.FocusVisualStyle">
  198. <Setter.Value>
  199. <Style TargetType="{x:Type IFrameworkInputElement}">
  200. <Setter Property="Control.Template">
  201. <Setter.Value>
  202. <ControlTemplate>
  203. <Rectangle
  204. Margin="2"
  205. SnapsToDevicePixels="True"
  206. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  207. StrokeDashArray="1 2"
  208. StrokeThickness="1" />
  209. </ControlTemplate>
  210. </Setter.Value>
  211. </Setter>
  212. </Style>
  213. </Setter.Value>
  214. </Setter>
  215. <Setter Property="Control.Template">
  216. <Setter.Value>
  217. <ControlTemplate TargetType="{x:Type ListViewItem}">
  218. <Border
  219. Name="Bd"
  220. Margin="0,0,12,24"
  221. Padding="{TemplateBinding Control.Padding}"
  222. Background="{TemplateBinding Panel.Background}"
  223. BorderBrush="{TemplateBinding Border.BorderBrush}"
  224. BorderThickness="{TemplateBinding Border.BorderThickness}"
  225. SnapsToDevicePixels="True">
  226. <Grid>
  227. <ContentPresenter
  228. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  229. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  230. Content="{TemplateBinding ContentControl.Content}"
  231. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  232. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  233. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  234. <Grid
  235. x:Name="SelectedIcon"
  236. HorizontalAlignment="Right"
  237. VerticalAlignment="Top"
  238. Visibility="Collapsed" />
  239. <Grid
  240. x:Name="UnSelectedIcon"
  241. HorizontalAlignment="Right"
  242. VerticalAlignment="Top"
  243. Visibility="Collapsed">
  244. <Rectangle
  245. x:Name="UnSelectedrect"
  246. Width="20"
  247. Height="20"
  248. HorizontalAlignment="Right"
  249. VerticalAlignment="Top"
  250. Fill="#FFE2E3E6" />
  251. </Grid>
  252. </Grid>
  253. </Border>
  254. <ControlTemplate.Triggers>
  255. <MultiTrigger>
  256. <MultiTrigger.Conditions>
  257. <Condition Property="UIElement.IsMouseOver" Value="True" />
  258. <Condition Property="Selector.IsSelected" Value="False" />
  259. </MultiTrigger.Conditions>
  260. <!--<Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />-->
  261. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF477EDE" />
  262. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Visible" />
  263. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  264. </MultiTrigger>
  265. <MultiTrigger>
  266. <MultiTrigger.Conditions>
  267. <Condition Property="Selector.IsSelectionActive" Value="False" />
  268. <Condition Property="Selector.IsSelected" Value="True" />
  269. </MultiTrigger.Conditions>
  270. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  271. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  272. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
  273. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  274. </MultiTrigger>
  275. <MultiTrigger>
  276. <MultiTrigger.Conditions>
  277. <Condition Property="Selector.IsSelectionActive" Value="True" />
  278. <Condition Property="Selector.IsSelected" Value="True" />
  279. </MultiTrigger.Conditions>
  280. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  281. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  282. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
  283. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  284. </MultiTrigger>
  285. <Trigger Property="UIElement.IsEnabled" Value="False">
  286. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  287. </Trigger>
  288. </ControlTemplate.Triggers>
  289. </ControlTemplate>
  290. </Setter.Value>
  291. </Setter>
  292. </Style>
  293. <Style x:Key="FilesGridViewStyle" TargetType="{x:Type ListView}">
  294. <Setter Property="Template">
  295. <Setter.Value>
  296. <ControlTemplate TargetType="{x:Type ListView}">
  297. <Border
  298. x:Name="Bd"
  299. Padding="1"
  300. Background="{TemplateBinding Background}"
  301. BorderBrush="{TemplateBinding BorderBrush}"
  302. BorderThickness="{TemplateBinding BorderThickness}"
  303. SnapsToDevicePixels="true">
  304. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  305. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  306. </ScrollViewer>
  307. </Border>
  308. </ControlTemplate>
  309. </Setter.Value>
  310. </Setter>
  311. </Style>
  312. <Style x:Key="EmptyListViewItem" TargetType="ListViewItem">
  313. <Setter Property="Padding" Value="0" />
  314. <Setter Property="HorizontalContentAlignment" Value="Left" />
  315. <Setter Property="VerticalContentAlignment" Value="Center" />
  316. <Setter Property="MinWidth" Value="88" />
  317. <Setter Property="MinHeight" Value="0" />
  318. <Setter Property="AllowDrop" Value="False" />
  319. <Setter Property="Template">
  320. <Setter.Value>
  321. <ControlTemplate TargetType="ListViewItem">
  322. <ContentControl HorizontalContentAlignment="Stretch" Width="{TemplateBinding Width}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
  323. </ControlTemplate>
  324. </Setter.Value>
  325. </Setter>
  326. </Style>
  327. </ResourceDictionary>