ListViewStyle.xaml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:i="http://schemas.microsoft.com/xaml/behaviors">
  5. <Style x:Key="FilesListViewStyle" TargetType="{x:Type ListView}">
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="{x:Type ListView}">
  9. <Border
  10. x:Name="Bd"
  11. Padding="1"
  12. Background="{TemplateBinding Background}"
  13. BorderBrush="{TemplateBinding BorderBrush}"
  14. BorderThickness="{TemplateBinding BorderThickness}"
  15. SnapsToDevicePixels="true">
  16. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  17. <Grid>
  18. <Grid.RowDefinitions>
  19. <RowDefinition Height="Auto" />
  20. <RowDefinition />
  21. </Grid.RowDefinitions>
  22. <Grid>
  23. <Grid.ColumnDefinitions>
  24. <ColumnDefinition Width="4.5*" MinWidth="0" />
  25. <ColumnDefinition Width="3*" />
  26. <ColumnDefinition Width="2*" />
  27. <ColumnDefinition Width="100" />
  28. </Grid.ColumnDefinitions>
  29. <!-- 以下是列表模式的列标题 -->
  30. <TextBlock
  31. Margin="12,0,0,6"
  32. HorizontalAlignment="Left"
  33. VerticalAlignment="Center"
  34. FontSize="14" />
  35. <TextBlock
  36. Grid.Column="1"
  37. Margin="0,0,0,6"
  38. HorizontalAlignment="Center"
  39. VerticalAlignment="Center"
  40. FontSize="14"
  41. TextAlignment="Center"
  42. TextWrapping="Wrap" />
  43. <TextBlock
  44. Grid.Column="2"
  45. Margin="0,0,0,6"
  46. HorizontalAlignment="Center"
  47. VerticalAlignment="Center"
  48. FontSize="14" />
  49. <!-- 列表模式的列标题的分隔线 -->
  50. <Rectangle
  51. Grid.ColumnSpan="4"
  52. Height="0"
  53. Margin="12,0,0,0"
  54. HorizontalAlignment="Stretch"
  55. VerticalAlignment="Bottom"
  56. Fill="#26000000" />
  57. </Grid>
  58. <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  59. </Grid>
  60. </ScrollViewer>
  61. </Border>
  62. </ControlTemplate>
  63. </Setter.Value>
  64. </Setter>
  65. </Style>
  66. <Style x:Key="FilesListViewItemStyle" TargetType="{x:Type ListViewItem}">
  67. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  68. <Setter Property="Panel.Background" Value="#00FFFFFF" />
  69. <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
  70. <Setter Property="Border.BorderThickness" Value="1" />
  71. <Setter Property="FrameworkElement.FocusVisualStyle">
  72. <Setter.Value>
  73. <Style TargetType="{x:Type IFrameworkInputElement}">
  74. <Setter Property="Control.Template">
  75. <Setter.Value>
  76. <ControlTemplate>
  77. <Rectangle
  78. Margin="2"
  79. SnapsToDevicePixels="True"
  80. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  81. StrokeDashArray="1 2"
  82. StrokeThickness="1" />
  83. </ControlTemplate>
  84. </Setter.Value>
  85. </Setter>
  86. </Style>
  87. </Setter.Value>
  88. </Setter>
  89. <Setter Property="Control.Template">
  90. <Setter.Value>
  91. <ControlTemplate TargetType="{x:Type ListViewItem}">
  92. <Border
  93. Name="Bd"
  94. Padding="{TemplateBinding Control.Padding}"
  95. Background="{TemplateBinding Panel.Background}"
  96. BorderBrush="{TemplateBinding Border.BorderBrush}"
  97. BorderThickness="{TemplateBinding Border.BorderThickness}"
  98. SnapsToDevicePixels="True">
  99. <Grid>
  100. <Grid.ColumnDefinitions>
  101. <ColumnDefinition Width="Auto" />
  102. <ColumnDefinition />
  103. </Grid.ColumnDefinitions>
  104. <Grid
  105. x:Name="SelectedIcon"
  106. Margin="12.5,0,0.5,0"
  107. HorizontalAlignment="Left"
  108. VerticalAlignment="Center"
  109. Visibility="Collapsed">
  110. <Rectangle
  111. x:Name="Selectedrect"
  112. Width="20"
  113. Height="20"
  114. HorizontalAlignment="Right"
  115. VerticalAlignment="Top"
  116. Fill="#FF477EDE" />
  117. <Path
  118. x:Name="MultiSelectCheck"
  119. Width="15"
  120. Height="15"
  121. Margin="0,1,0,0"
  122. HorizontalAlignment="Center"
  123. VerticalAlignment="Center"
  124. Data="M15.3493 0.596191L16.0564 1.3033L5.44979 11.9099L0.146484 6.6066L0.853591 5.89949L5.45004 10.496L15.3493 0.596191Z"
  125. Fill="White" />
  126. </Grid>
  127. <ContentPresenter
  128. Grid.Column="1"
  129. Margin="15,0,0,0"
  130. HorizontalAlignment="Stretch"
  131. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  132. Content="{TemplateBinding ContentControl.Content}"
  133. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  134. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  135. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  136. <Rectangle
  137. Grid.Column="1"
  138. Height="1"
  139. HorizontalAlignment="Stretch"
  140. VerticalAlignment="Bottom"
  141. Fill="#C5CBD3" />
  142. </Grid>
  143. </Border>
  144. <ControlTemplate.Triggers>
  145. <MultiTrigger>
  146. <MultiTrigger.Conditions>
  147. <Condition Property="UIElement.IsMouseOver" Value="True" />
  148. </MultiTrigger.Conditions>
  149. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A000000" />
  150. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />
  151. </MultiTrigger>
  152. <MultiTrigger>
  153. <MultiTrigger.Conditions>
  154. <Condition Property="Selector.IsSelectionActive" Value="False" />
  155. <Condition Property="Selector.IsSelected" Value="True" />
  156. </MultiTrigger.Conditions>
  157. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  158. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  159. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  160. </MultiTrigger>
  161. <MultiTrigger>
  162. <MultiTrigger.Conditions>
  163. <Condition Property="Selector.IsSelectionActive" Value="True" />
  164. <Condition Property="Selector.IsSelected" Value="True" />
  165. </MultiTrigger.Conditions>
  166. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  167. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  168. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  169. </MultiTrigger>
  170. <Trigger Property="UIElement.IsEnabled" Value="False">
  171. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  172. </Trigger>
  173. </ControlTemplate.Triggers>
  174. </ControlTemplate>
  175. </Setter.Value>
  176. </Setter>
  177. </Style>
  178. <Style x:Key="FilesGridItemStyle" TargetType="{x:Type ListViewItem}">
  179. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  180. <!--<Setter Property="Control.Padding" Value="4,1" />
  181. <Setter Property="Control.HorizontalContentAlignment">
  182. <Setter.Value>
  183. <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  184. </Setter.Value>
  185. </Setter>
  186. <Setter Property="Control.VerticalContentAlignment">
  187. <Setter.Value>
  188. <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  189. </Setter.Value>
  190. </Setter>-->
  191. <Setter Property="Panel.Background" Value="#00FFFFFF" />
  192. <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
  193. <Setter Property="Border.BorderThickness" Value="2" />
  194. <Setter Property="FrameworkElement.FocusVisualStyle">
  195. <Setter.Value>
  196. <Style TargetType="{x:Type IFrameworkInputElement}">
  197. <Setter Property="Control.Template">
  198. <Setter.Value>
  199. <ControlTemplate>
  200. <Rectangle
  201. Margin="2"
  202. SnapsToDevicePixels="True"
  203. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  204. StrokeDashArray="1 2"
  205. StrokeThickness="1" />
  206. </ControlTemplate>
  207. </Setter.Value>
  208. </Setter>
  209. </Style>
  210. </Setter.Value>
  211. </Setter>
  212. <Setter Property="Control.Template">
  213. <Setter.Value>
  214. <ControlTemplate TargetType="{x:Type ListViewItem}">
  215. <Border
  216. Name="Bd"
  217. Margin="0,0,12,24"
  218. Padding="{TemplateBinding Control.Padding}"
  219. Background="{TemplateBinding Panel.Background}"
  220. BorderBrush="{TemplateBinding Border.BorderBrush}"
  221. BorderThickness="{TemplateBinding Border.BorderThickness}"
  222. SnapsToDevicePixels="True">
  223. <Grid>
  224. <ContentPresenter
  225. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  226. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  227. Content="{TemplateBinding ContentControl.Content}"
  228. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  229. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  230. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  231. <Grid
  232. x:Name="SelectedIcon"
  233. HorizontalAlignment="Right"
  234. VerticalAlignment="Top"
  235. Visibility="Collapsed" />
  236. <Grid
  237. x:Name="UnSelectedIcon"
  238. HorizontalAlignment="Right"
  239. VerticalAlignment="Top"
  240. Visibility="Collapsed">
  241. <Rectangle
  242. x:Name="UnSelectedrect"
  243. Width="20"
  244. Height="20"
  245. HorizontalAlignment="Right"
  246. VerticalAlignment="Top"
  247. Fill="#FFE2E3E6" />
  248. </Grid>
  249. </Grid>
  250. </Border>
  251. <ControlTemplate.Triggers>
  252. <MultiTrigger>
  253. <MultiTrigger.Conditions>
  254. <Condition Property="UIElement.IsMouseOver" Value="True" />
  255. <Condition Property="Selector.IsSelected" Value="False" />
  256. </MultiTrigger.Conditions>
  257. <!--<Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />-->
  258. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF477EDE" />
  259. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Visible" />
  260. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  261. </MultiTrigger>
  262. <MultiTrigger>
  263. <MultiTrigger.Conditions>
  264. <Condition Property="Selector.IsSelectionActive" Value="False" />
  265. <Condition Property="Selector.IsSelected" Value="True" />
  266. </MultiTrigger.Conditions>
  267. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  268. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  269. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
  270. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  271. </MultiTrigger>
  272. <MultiTrigger>
  273. <MultiTrigger.Conditions>
  274. <Condition Property="Selector.IsSelectionActive" Value="True" />
  275. <Condition Property="Selector.IsSelected" Value="True" />
  276. </MultiTrigger.Conditions>
  277. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  278. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  279. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
  280. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  281. </MultiTrigger>
  282. <Trigger Property="UIElement.IsEnabled" Value="False">
  283. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  284. </Trigger>
  285. </ControlTemplate.Triggers>
  286. </ControlTemplate>
  287. </Setter.Value>
  288. </Setter>
  289. </Style>
  290. <Style x:Key="FilesGridViewStyle" TargetType="{x:Type ListView}">
  291. <Setter Property="Template">
  292. <Setter.Value>
  293. <ControlTemplate TargetType="{x:Type ListView}">
  294. <Border
  295. x:Name="Bd"
  296. Padding="1"
  297. Background="{TemplateBinding Background}"
  298. BorderBrush="{TemplateBinding BorderBrush}"
  299. BorderThickness="{TemplateBinding BorderThickness}"
  300. SnapsToDevicePixels="true">
  301. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  302. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  303. </ScrollViewer>
  304. </Border>
  305. </ControlTemplate>
  306. </Setter.Value>
  307. </Setter>
  308. </Style>
  309. <Style x:Key="EmptyListViewItem" TargetType="ListViewItem">
  310. <Setter Property="Padding" Value="0" />
  311. <Setter Property="HorizontalContentAlignment" Value="Left" />
  312. <Setter Property="VerticalContentAlignment" Value="Center" />
  313. <Setter Property="MinWidth" Value="88" />
  314. <Setter Property="MinHeight" Value="0" />
  315. <Setter Property="AllowDrop" Value="False" />
  316. <Setter Property="Template">
  317. <Setter.Value>
  318. <ControlTemplate TargetType="ListViewItem">
  319. <ContentControl
  320. Width="{TemplateBinding Width}"
  321. HorizontalContentAlignment="Stretch"
  322. Content="{TemplateBinding Content}"
  323. ContentTemplate="{TemplateBinding ContentTemplate}" />
  324. </ControlTemplate>
  325. </Setter.Value>
  326. </Setter>
  327. </Style>
  328. <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
  329. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  330. <Setter Property="Panel.Background" Value="#F2F2F2" />
  331. <Setter Property="Border.BorderBrush" Value="#F2F2F2" />
  332. <Setter Property="Control.Template">
  333. <Setter.Value>
  334. <ControlTemplate TargetType="{x:Type ListViewItem}">
  335. <Border
  336. Name="Bd"
  337. Background="{TemplateBinding Panel.Background}"
  338. BorderBrush="{TemplateBinding Border.BorderBrush}"
  339. SnapsToDevicePixels="True">
  340. <ContentPresenter
  341. Margin="0"
  342. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  343. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  344. Content="{TemplateBinding ContentControl.Content}"
  345. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  346. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  347. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  348. </Border>
  349. <ControlTemplate.Triggers>
  350. <MultiTrigger>
  351. <MultiTrigger.Conditions>
  352. <Condition Property="UIElement.IsMouseOver" Value="True" />
  353. </MultiTrigger.Conditions>
  354. <Setter Property="Panel.Background" Value="#d9d9d9" />
  355. <Setter Property="Border.BorderBrush" Value="#d9d9d9" />
  356. </MultiTrigger>
  357. <MultiTrigger>
  358. <MultiTrigger.Conditions>
  359. <Condition Property="UIElement.IsMouseOver" Value="False" />
  360. </MultiTrigger.Conditions>
  361. <Setter Property="Panel.Background" Value="#F2F2F2" />
  362. <Setter Property="Border.BorderBrush" Value="#F2F2F2" />
  363. </MultiTrigger>
  364. <MultiTrigger>
  365. <MultiTrigger.Conditions>
  366. <Condition Property="Selector.IsSelectionActive" Value="False" />
  367. <Condition Property="Selector.IsSelected" Value="True" />
  368. </MultiTrigger.Conditions>
  369. <Setter Property="Panel.Background" Value="#97D7FB" />
  370. <Setter Property="Border.BorderBrush" Value="#97D7FB" />
  371. </MultiTrigger>
  372. <MultiTrigger>
  373. <MultiTrigger.Conditions>
  374. <Condition Property="Selector.IsSelectionActive" Value="True" />
  375. <Condition Property="Selector.IsSelected" Value="True" />
  376. </MultiTrigger.Conditions>
  377. <Setter Property="Panel.Background" Value="#97D7FB" />
  378. <Setter Property="Border.BorderBrush" Value="#97D7FB" />
  379. </MultiTrigger>
  380. <!--<Trigger Property="UIElement.IsEnabled" Value="False">
  381. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  382. </Trigger>-->
  383. </ControlTemplate.Triggers>
  384. </ControlTemplate>
  385. </Setter.Value>
  386. </Setter>
  387. </Style>
  388. <ControlTemplate x:Key="AnnotationListItemStyle" TargetType="{x:Type ListBoxItem}">
  389. <Border
  390. x:Name="Bd"
  391. Margin="5,0,5,10"
  392. Padding="5"
  393. Background="#f5f5f5"
  394. BorderBrush="{TemplateBinding BorderBrush}"
  395. BorderThickness="{TemplateBinding BorderThickness}"
  396. CornerRadius="4"
  397. SnapsToDevicePixels="True">
  398. <ContentPresenter
  399. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  400. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  401. Content="{TemplateBinding Content}"
  402. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  403. ContentTemplate="{TemplateBinding ContentTemplate}"
  404. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  405. </Border>
  406. <ControlTemplate.Triggers>
  407. <MultiTrigger>
  408. <MultiTrigger.Conditions>
  409. <Condition Property="IsMouseOver" Value="True" />
  410. </MultiTrigger.Conditions>
  411. <Setter TargetName="Bd" Property="Background" Value="#EDEEF0" />
  412. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  413. </MultiTrigger>
  414. <MultiTrigger>
  415. <MultiTrigger.Conditions>
  416. <Condition Property="Selector.IsSelectionActive" Value="False" />
  417. <Condition Property="IsSelected" Value="True" />
  418. </MultiTrigger.Conditions>
  419. <Setter TargetName="Bd" Property="Background" Value="#d7d8db" />
  420. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  421. </MultiTrigger>
  422. <MultiTrigger>
  423. <MultiTrigger.Conditions>
  424. <Condition Property="Selector.IsSelectionActive" Value="True" />
  425. <Condition Property="IsSelected" Value="True" />
  426. </MultiTrigger.Conditions>
  427. <Setter TargetName="Bd" Property="Background" Value="#d7d8db" />
  428. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  429. </MultiTrigger>
  430. <Trigger Property="IsEnabled" Value="False">
  431. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  432. </Trigger>
  433. </ControlTemplate.Triggers>
  434. </ControlTemplate>
  435. </ResourceDictionary>