ListViewStyle.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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. CornerRadius="{StaticResource border-radius.4}"
  99. SnapsToDevicePixels="True">
  100. <Grid>
  101. <Grid.ColumnDefinitions>
  102. <ColumnDefinition Width="Auto" />
  103. <ColumnDefinition />
  104. </Grid.ColumnDefinitions>
  105. <Grid
  106. x:Name="SelectedIcon"
  107. Margin="12.5,0,0.5,0"
  108. HorizontalAlignment="Left"
  109. VerticalAlignment="Center"
  110. Visibility="Collapsed">
  111. <Rectangle
  112. x:Name="Selectedrect"
  113. Width="20"
  114. Height="20"
  115. HorizontalAlignment="Right"
  116. VerticalAlignment="Top"
  117. Fill="#FF477EDE" />
  118. <Path
  119. x:Name="MultiSelectCheck"
  120. Width="15"
  121. Height="15"
  122. Margin="0,1,0,0"
  123. HorizontalAlignment="Center"
  124. VerticalAlignment="Center"
  125. Data="M15.3493 0.596191L16.0564 1.3033L5.44979 11.9099L0.146484 6.6066L0.853591 5.89949L5.45004 10.496L15.3493 0.596191Z"
  126. Fill="White" />
  127. </Grid>
  128. <ContentPresenter
  129. Grid.Column="1"
  130. Margin="0,0,0,0"
  131. HorizontalAlignment="Stretch"
  132. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  133. Content="{TemplateBinding ContentControl.Content}"
  134. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  135. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  136. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  137. <Rectangle
  138. Grid.Column="1"
  139. Height="1"
  140. HorizontalAlignment="Stretch"
  141. VerticalAlignment="Bottom"
  142. Fill="#C5CBD3" />
  143. </Grid>
  144. </Border>
  145. <ControlTemplate.Triggers>
  146. <MultiTrigger>
  147. <MultiTrigger.Conditions>
  148. <Condition Property="UIElement.IsMouseOver" Value="True" />
  149. </MultiTrigger.Conditions>
  150. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.hov.bg}" />
  151. <!--<Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />-->
  152. </MultiTrigger>
  153. <MultiTrigger>
  154. <MultiTrigger.Conditions>
  155. <Condition Property="Selector.IsSelectionActive" Value="False" />
  156. <Condition Property="Selector.IsSelected" Value="True" />
  157. </MultiTrigger.Conditions>
  158. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  159. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  160. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  161. </MultiTrigger>
  162. <MultiTrigger>
  163. <MultiTrigger.Conditions>
  164. <Condition Property="Selector.IsSelectionActive" Value="True" />
  165. <Condition Property="Selector.IsSelected" Value="True" />
  166. </MultiTrigger.Conditions>
  167. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  168. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  169. <!--<Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />-->
  170. </MultiTrigger>
  171. <Trigger Property="UIElement.IsEnabled" Value="False">
  172. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  173. </Trigger>
  174. </ControlTemplate.Triggers>
  175. </ControlTemplate>
  176. </Setter.Value>
  177. </Setter>
  178. </Style>
  179. <Style x:Key="FilesGridItemStyle" TargetType="{x:Type ListViewItem}">
  180. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  181. <!--<Setter Property="Control.Padding" Value="4,1" />
  182. <Setter Property="Control.HorizontalContentAlignment">
  183. <Setter.Value>
  184. <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  185. </Setter.Value>
  186. </Setter>
  187. <Setter Property="Control.VerticalContentAlignment">
  188. <Setter.Value>
  189. <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
  190. </Setter.Value>
  191. </Setter>-->
  192. <Setter Property="Panel.Background" Value="#00FFFFFF" />
  193. <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
  194. <Setter Property="Border.BorderThickness" Value="2" />
  195. <Setter Property="FrameworkElement.FocusVisualStyle">
  196. <Setter.Value>
  197. <Style TargetType="{x:Type IFrameworkInputElement}">
  198. <Setter Property="Control.Template">
  199. <Setter.Value>
  200. <ControlTemplate>
  201. <Rectangle
  202. Margin="2"
  203. SnapsToDevicePixels="True"
  204. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  205. StrokeDashArray="1 2"
  206. StrokeThickness="1" />
  207. </ControlTemplate>
  208. </Setter.Value>
  209. </Setter>
  210. </Style>
  211. </Setter.Value>
  212. </Setter>
  213. <Setter Property="Control.Template">
  214. <Setter.Value>
  215. <ControlTemplate TargetType="{x:Type ListViewItem}">
  216. <Border
  217. Name="Bd"
  218. Margin="0,0,12,24"
  219. Padding="{TemplateBinding Control.Padding}"
  220. Background="{TemplateBinding Panel.Background}"
  221. BorderBrush="{TemplateBinding Border.BorderBrush}"
  222. BorderThickness="{TemplateBinding Border.BorderThickness}"
  223. CornerRadius="{StaticResource border-radius.8}"
  224. SnapsToDevicePixels="True">
  225. <Grid>
  226. <ContentPresenter
  227. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  228. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  229. Content="{TemplateBinding ContentControl.Content}"
  230. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  231. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  232. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  233. <Grid
  234. x:Name="SelectedIcon"
  235. HorizontalAlignment="Right"
  236. VerticalAlignment="Top"
  237. Visibility="Collapsed" />
  238. <Grid
  239. x:Name="UnSelectedIcon"
  240. HorizontalAlignment="Right"
  241. VerticalAlignment="Top"
  242. Visibility="Collapsed">
  243. <Rectangle
  244. x:Name="UnSelectedrect"
  245. Width="20"
  246. Height="20"
  247. HorizontalAlignment="Right"
  248. VerticalAlignment="Top"
  249. Fill="#FFE2E3E6" />
  250. </Grid>
  251. </Grid>
  252. </Border>
  253. <ControlTemplate.Triggers>
  254. <MultiTrigger>
  255. <MultiTrigger.Conditions>
  256. <Condition Property="UIElement.IsMouseOver" Value="True" />
  257. <Condition Property="Selector.IsSelected" Value="False" />
  258. </MultiTrigger.Conditions>
  259. <!--<Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />-->
  260. <Setter TargetName="Bd" Property="Border.Background" Value="{StaticResource color.item-state.hov.bg}" />
  261. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  262. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  263. </MultiTrigger>
  264. <MultiTrigger>
  265. <MultiTrigger.Conditions>
  266. <Condition Property="Selector.IsSelectionActive" Value="False" />
  267. <Condition Property="Selector.IsSelected" Value="True" />
  268. </MultiTrigger.Conditions>
  269. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  270. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  271. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  272. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  273. </MultiTrigger>
  274. <MultiTrigger>
  275. <MultiTrigger.Conditions>
  276. <Condition Property="Selector.IsSelectionActive" Value="True" />
  277. <Condition Property="Selector.IsSelected" Value="True" />
  278. </MultiTrigger.Conditions>
  279. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  280. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  281. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  282. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  283. </MultiTrigger>
  284. <Trigger Property="UIElement.IsEnabled" Value="False">
  285. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  286. </Trigger>
  287. </ControlTemplate.Triggers>
  288. </ControlTemplate>
  289. </Setter.Value>
  290. </Setter>
  291. </Style>
  292. <Style x:Key="FilesGridViewStyle" TargetType="{x:Type ListView}">
  293. <Setter Property="Template">
  294. <Setter.Value>
  295. <ControlTemplate TargetType="{x:Type ListView}">
  296. <Border
  297. x:Name="Bd"
  298. Padding="1"
  299. Background="{TemplateBinding Background}"
  300. BorderBrush="{TemplateBinding BorderBrush}"
  301. BorderThickness="{TemplateBinding BorderThickness}"
  302. SnapsToDevicePixels="true">
  303. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  304. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  305. </ScrollViewer>
  306. </Border>
  307. </ControlTemplate>
  308. </Setter.Value>
  309. </Setter>
  310. </Style>
  311. <Style x:Key="EmptyListViewItem" TargetType="ListViewItem">
  312. <Setter Property="Padding" Value="0" />
  313. <Setter Property="HorizontalContentAlignment" Value="Left" />
  314. <Setter Property="VerticalContentAlignment" Value="Center" />
  315. <Setter Property="MinWidth" Value="88" />
  316. <Setter Property="MinHeight" Value="0" />
  317. <Setter Property="Background" Value="Transparent" />
  318. <Setter Property="AllowDrop" Value="False" />
  319. <Setter Property="Template">
  320. <Setter.Value>
  321. <ControlTemplate TargetType="ListViewItem">
  322. <Border Background="{TemplateBinding Background}">
  323. <ContentControl
  324. Width="{TemplateBinding Width}"
  325. HorizontalContentAlignment="Stretch"
  326. Content="{TemplateBinding Content}"
  327. ContentTemplate="{TemplateBinding ContentTemplate}" />
  328. </Border>
  329. </ControlTemplate>
  330. </Setter.Value>
  331. </Setter>
  332. </Style>
  333. <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
  334. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  335. <Setter Property="Panel.Background" Value="{StaticResource color.sys.layout.mg}" />
  336. <Setter Property="Border.BorderBrush" Value="{StaticResource color.sys.layout.mg}" />
  337. <Setter Property="Margin" Value="8,0" />
  338. <Setter Property="Control.Template">
  339. <Setter.Value>
  340. <ControlTemplate TargetType="{x:Type ListViewItem}">
  341. <Border
  342. Name="Bd"
  343. Background="{TemplateBinding Panel.Background}"
  344. BorderBrush="{TemplateBinding Border.BorderBrush}"
  345. BorderThickness="1"
  346. CornerRadius="4"
  347. SnapsToDevicePixels="True">
  348. <ContentPresenter
  349. Margin="0"
  350. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  351. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  352. Content="{TemplateBinding ContentControl.Content}"
  353. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  354. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  355. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  356. </Border>
  357. <ControlTemplate.Triggers>
  358. <MultiTrigger>
  359. <MultiTrigger.Conditions>
  360. <Condition Property="UIElement.IsMouseOver" Value="True" />
  361. </MultiTrigger.Conditions>
  362. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.hov.bg}" />
  363. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.hov.bg}" />
  364. </MultiTrigger>
  365. <!--<MultiTrigger>
  366. <MultiTrigger.Conditions>
  367. <Condition Property="UIElement.IsMouseOver" Value="False" />
  368. </MultiTrigger.Conditions>
  369. <Setter Property="Panel.Background" Value="#F2F2F2" />
  370. <Setter Property="Border.BorderBrush" Value="#F2F2F2" />
  371. </MultiTrigger>-->
  372. <MultiTrigger>
  373. <MultiTrigger.Conditions>
  374. <Condition Property="Selector.IsSelectionActive" Value="False" />
  375. <Condition Property="Selector.IsSelected" Value="True" />
  376. </MultiTrigger.Conditions>
  377. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  378. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  379. </MultiTrigger>
  380. <MultiTrigger>
  381. <MultiTrigger.Conditions>
  382. <Condition Property="Selector.IsSelectionActive" Value="True" />
  383. <Condition Property="Selector.IsSelected" Value="True" />
  384. </MultiTrigger.Conditions>
  385. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  386. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  387. </MultiTrigger>
  388. <!--<Trigger Property="UIElement.IsEnabled" Value="False">
  389. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  390. </Trigger>-->
  391. </ControlTemplate.Triggers>
  392. </ControlTemplate>
  393. </Setter.Value>
  394. </Setter>
  395. </Style>
  396. <ControlTemplate x:Key="AnnotationListItemStyle" TargetType="{x:Type ListBoxItem}">
  397. <Border
  398. x:Name="Bd"
  399. Margin="5"
  400. Padding="8"
  401. Background="{StaticResource color.sys.layout.mg}"
  402. BorderBrush="{TemplateBinding BorderBrush}"
  403. BorderThickness="{TemplateBinding BorderThickness}"
  404. CornerRadius="4"
  405. SnapsToDevicePixels="True">
  406. <ContentPresenter
  407. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  408. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  409. Content="{TemplateBinding Content}"
  410. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  411. ContentTemplate="{TemplateBinding ContentTemplate}"
  412. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  413. </Border>
  414. <ControlTemplate.Triggers>
  415. <MultiTrigger>
  416. <MultiTrigger.Conditions>
  417. <Condition Property="IsMouseOver" Value="True" />
  418. </MultiTrigger.Conditions>
  419. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  420. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  421. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  422. </MultiTrigger>
  423. <MultiTrigger>
  424. <MultiTrigger.Conditions>
  425. <Condition Property="Selector.IsSelectionActive" Value="False" />
  426. <Condition Property="IsSelected" Value="True" />
  427. </MultiTrigger.Conditions>
  428. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  429. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  430. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  431. </MultiTrigger>
  432. <MultiTrigger>
  433. <MultiTrigger.Conditions>
  434. <Condition Property="Selector.IsSelectionActive" Value="True" />
  435. <Condition Property="IsSelected" Value="True" />
  436. </MultiTrigger.Conditions>
  437. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  438. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  439. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  440. </MultiTrigger>
  441. <Trigger Property="IsEnabled" Value="False">
  442. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  443. </Trigger>
  444. </ControlTemplate.Triggers>
  445. </ControlTemplate>
  446. </ResourceDictionary>