ListViewStyle.xaml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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="0,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="{StaticResource color.item-state.hov.bg}" />
  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="{StaticResource color.item-state.sel.bg.lv3}" />
  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="{StaticResource color.item-state.sel.bg.lv3}" />
  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. CornerRadius="{StaticResource border-radius.8}"
  223. SnapsToDevicePixels="True">
  224. <Grid>
  225. <ContentPresenter
  226. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  227. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  228. Content="{TemplateBinding ContentControl.Content}"
  229. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  230. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  231. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  232. <Grid
  233. x:Name="SelectedIcon"
  234. HorizontalAlignment="Right"
  235. VerticalAlignment="Top"
  236. Visibility="Collapsed" />
  237. <Grid
  238. x:Name="UnSelectedIcon"
  239. HorizontalAlignment="Right"
  240. VerticalAlignment="Top"
  241. Visibility="Collapsed">
  242. <Rectangle
  243. x:Name="UnSelectedrect"
  244. Width="20"
  245. Height="20"
  246. HorizontalAlignment="Right"
  247. VerticalAlignment="Top"
  248. Fill="#FFE2E3E6" />
  249. </Grid>
  250. </Grid>
  251. </Border>
  252. <ControlTemplate.Triggers>
  253. <MultiTrigger>
  254. <MultiTrigger.Conditions>
  255. <Condition Property="UIElement.IsMouseOver" Value="True" />
  256. <Condition Property="Selector.IsSelected" Value="False" />
  257. </MultiTrigger.Conditions>
  258. <!--<Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />-->
  259. <Setter TargetName="Bd" Property="Border.Background" Value="{StaticResource color.item-state.hov.bg}" />
  260. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  261. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  262. </MultiTrigger>
  263. <MultiTrigger>
  264. <MultiTrigger.Conditions>
  265. <Condition Property="Selector.IsSelectionActive" Value="False" />
  266. <Condition Property="Selector.IsSelected" Value="True" />
  267. </MultiTrigger.Conditions>
  268. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  269. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  270. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  271. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  272. </MultiTrigger>
  273. <MultiTrigger>
  274. <MultiTrigger.Conditions>
  275. <Condition Property="Selector.IsSelectionActive" Value="True" />
  276. <Condition Property="Selector.IsSelected" Value="True" />
  277. </MultiTrigger.Conditions>
  278. <Setter TargetName="Bd" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  279. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  280. <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  281. <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
  282. </MultiTrigger>
  283. <Trigger Property="UIElement.IsEnabled" Value="False">
  284. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  285. </Trigger>
  286. </ControlTemplate.Triggers>
  287. </ControlTemplate>
  288. </Setter.Value>
  289. </Setter>
  290. </Style>
  291. <Style x:Key="FilesGridViewStyle" TargetType="{x:Type ListView}">
  292. <Setter Property="Template">
  293. <Setter.Value>
  294. <ControlTemplate TargetType="{x:Type ListView}">
  295. <Border
  296. x:Name="Bd"
  297. Padding="1"
  298. Background="{TemplateBinding Background}"
  299. BorderBrush="{TemplateBinding BorderBrush}"
  300. BorderThickness="{TemplateBinding BorderThickness}"
  301. SnapsToDevicePixels="true">
  302. <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
  303. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  304. </ScrollViewer>
  305. </Border>
  306. </ControlTemplate>
  307. </Setter.Value>
  308. </Setter>
  309. </Style>
  310. <Style x:Key="EmptyListViewItem" TargetType="ListViewItem">
  311. <Setter Property="Padding" Value="0" />
  312. <Setter Property="HorizontalContentAlignment" Value="Left" />
  313. <Setter Property="VerticalContentAlignment" Value="Center" />
  314. <Setter Property="MinWidth" Value="88" />
  315. <Setter Property="MinHeight" Value="0" />
  316. <Setter Property="Background" Value="Transparent" />
  317. <Setter Property="AllowDrop" Value="False" />
  318. <Setter Property="Template">
  319. <Setter.Value>
  320. <ControlTemplate TargetType="ListViewItem">
  321. <Border Background="{TemplateBinding Background}">
  322. <ContentControl
  323. Width="{TemplateBinding Width}"
  324. HorizontalContentAlignment="Stretch"
  325. Content="{TemplateBinding Content}"
  326. ContentTemplate="{TemplateBinding ContentTemplate}" />
  327. </Border>
  328. </ControlTemplate>
  329. </Setter.Value>
  330. </Setter>
  331. </Style>
  332. <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
  333. <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
  334. <Setter Property="Panel.Background" Value="{StaticResource color.sys.layout.mg}" />
  335. <Setter Property="Border.BorderBrush" Value="{StaticResource color.sys.layout.mg}" />
  336. <Setter Property="Margin" Value="8,0" />
  337. <Setter Property="Control.Template">
  338. <Setter.Value>
  339. <ControlTemplate TargetType="{x:Type ListViewItem}">
  340. <Border
  341. Name="Bd"
  342. Background="{TemplateBinding Panel.Background}"
  343. BorderBrush="{TemplateBinding Border.BorderBrush}"
  344. BorderThickness="1"
  345. CornerRadius="4"
  346. SnapsToDevicePixels="True">
  347. <ContentPresenter
  348. Margin="0"
  349. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  350. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  351. Content="{TemplateBinding ContentControl.Content}"
  352. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  353. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  354. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  355. </Border>
  356. <ControlTemplate.Triggers>
  357. <MultiTrigger>
  358. <MultiTrigger.Conditions>
  359. <Condition Property="UIElement.IsMouseOver" Value="True" />
  360. </MultiTrigger.Conditions>
  361. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.hov.bg}" />
  362. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.hov.bg}" />
  363. </MultiTrigger>
  364. <!--<MultiTrigger>
  365. <MultiTrigger.Conditions>
  366. <Condition Property="UIElement.IsMouseOver" Value="False" />
  367. </MultiTrigger.Conditions>
  368. <Setter Property="Panel.Background" Value="#F2F2F2" />
  369. <Setter Property="Border.BorderBrush" Value="#F2F2F2" />
  370. </MultiTrigger>-->
  371. <MultiTrigger>
  372. <MultiTrigger.Conditions>
  373. <Condition Property="Selector.IsSelectionActive" Value="False" />
  374. <Condition Property="Selector.IsSelected" Value="True" />
  375. </MultiTrigger.Conditions>
  376. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  377. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  378. </MultiTrigger>
  379. <MultiTrigger>
  380. <MultiTrigger.Conditions>
  381. <Condition Property="Selector.IsSelectionActive" Value="True" />
  382. <Condition Property="Selector.IsSelected" Value="True" />
  383. </MultiTrigger.Conditions>
  384. <Setter Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  385. <Setter Property="Border.BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  386. </MultiTrigger>
  387. <!--<Trigger Property="UIElement.IsEnabled" Value="False">
  388. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  389. </Trigger>-->
  390. </ControlTemplate.Triggers>
  391. </ControlTemplate>
  392. </Setter.Value>
  393. </Setter>
  394. </Style>
  395. <ControlTemplate x:Key="AnnotationListItemStyle" TargetType="{x:Type ListBoxItem}">
  396. <Border
  397. x:Name="Bd"
  398. Margin="5"
  399. Padding="8"
  400. Background="{StaticResource color.sys.layout.mg}"
  401. BorderBrush="{TemplateBinding BorderBrush}"
  402. BorderThickness="{TemplateBinding BorderThickness}"
  403. CornerRadius="4"
  404. SnapsToDevicePixels="True">
  405. <ContentPresenter
  406. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  407. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  408. Content="{TemplateBinding Content}"
  409. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  410. ContentTemplate="{TemplateBinding ContentTemplate}"
  411. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  412. </Border>
  413. <ControlTemplate.Triggers>
  414. <MultiTrigger>
  415. <MultiTrigger.Conditions>
  416. <Condition Property="IsMouseOver" Value="True" />
  417. </MultiTrigger.Conditions>
  418. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
  419. <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
  420. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  421. </MultiTrigger>
  422. <MultiTrigger>
  423. <MultiTrigger.Conditions>
  424. <Condition Property="Selector.IsSelectionActive" Value="False" />
  425. <Condition Property="IsSelected" Value="True" />
  426. </MultiTrigger.Conditions>
  427. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  428. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  429. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  430. </MultiTrigger>
  431. <MultiTrigger>
  432. <MultiTrigger.Conditions>
  433. <Condition Property="Selector.IsSelectionActive" Value="True" />
  434. <Condition Property="IsSelected" Value="True" />
  435. </MultiTrigger.Conditions>
  436. <Setter TargetName="Bd" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv3}" />
  437. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource color.item-state.sel.border.lv3}" />
  438. <!--<Setter Property="Margin" Value="5,0,5,10" />-->
  439. </MultiTrigger>
  440. <Trigger Property="IsEnabled" Value="False">
  441. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  442. </Trigger>
  443. </ControlTemplate.Triggers>
  444. </ControlTemplate>
  445. </ResourceDictionary>