NavHeaderItem.xaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:controls="using:ControlCatalog">
  4. <ResourceDictionary.ThemeDictionaries>
  5. <ResourceDictionary x:Key="Dark">
  6. <Color x:Key="HamburgerBaseHighColor">#99FFFFFF</Color>
  7. <Color x:Key="HamburgerChromeMediumColor">#FF1F1F1F</Color>
  8. <Color x:Key="HamburgerAltHighColor">#FF000000</Color>
  9. <Color x:Key="HamburgerChromeLowColor">#FF171717</Color>
  10. </ResourceDictionary>
  11. <ResourceDictionary x:Key="Default">
  12. <Color x:Key="HamburgerBaseHighColor">#99000000</Color>
  13. <Color x:Key="HamburgerChromeMediumColor">#FFE6E6E6</Color>
  14. <Color x:Key="HamburgerAltHighColor">#FFFFFFFF</Color>
  15. <Color x:Key="HamburgerChromeLowColor">#FFF2F2F2</Color>
  16. </ResourceDictionary>
  17. </ResourceDictionary.ThemeDictionaries>
  18. <x:Double x:Key="NavigationItemHeight">36</x:Double>
  19. <BoxShadows x:Key="NavigationItemShadow">1 1 1 1 #2000, 0 0 1 1 #2fff</BoxShadows>
  20. <Design.PreviewWith>
  21. <Border Padding="0">
  22. <ListBox ItemContainerTheme="{StaticResource NavHeaderItem}">
  23. <ListBoxItem IsEnabled="False">Disabled</ListBoxItem>
  24. <ListBoxItem>
  25. Test
  26. </ListBoxItem>
  27. <ListBoxItem>Test</ListBoxItem>
  28. </ListBox>
  29. </Border>
  30. </Design.PreviewWith>
  31. <ControlTheme x:Key="NavHeaderItem" TargetType="ListBoxItem">
  32. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  33. <Setter Property="VerticalContentAlignment" Value="Center" />
  34. <Setter Property="HorizontalAlignment" Value="Stretch" />
  35. <Setter Property="VerticalAlignment" Value="Stretch" />
  36. <Setter Property="Background" Value="Transparent" />
  37. <Setter Property="Height" Value="{StaticResource NavigationItemHeight}" />
  38. <Setter Property="Padding" Value="14,0,4,0" />
  39. <Setter Property="Margin" Value="4,2,8,0" />
  40. <Setter Property="CornerRadius" Value="8" />
  41. <Setter Property="ClipToBounds" Value="False" />
  42. <Setter Property="Template">
  43. <ControlTemplate>
  44. <Border Name="PART_LayoutRoot"
  45. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  46. Background="{TemplateBinding Background}"
  47. BorderBrush="{TemplateBinding BorderBrush}"
  48. BorderThickness="{TemplateBinding BorderThickness}"
  49. CornerRadius="{TemplateBinding CornerRadius}">
  50. <Panel>
  51. <Border Name="PART_SelectedPipe"
  52. Width="{DynamicResource TabItemPipeThickness}"
  53. Height="{DynamicResource TabItemVerticalPipeHeight}"
  54. Margin="6,0,0,0"
  55. HorizontalAlignment="Left"
  56. VerticalAlignment="Center"
  57. Background="{DynamicResource TabItemHeaderSelectedPipeFill}"
  58. IsVisible="False"
  59. CornerRadius="4"/>
  60. <ContentPresenter Name="PART_ContentPresenter"
  61. Padding="{TemplateBinding Padding}"
  62. Margin="0"
  63. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  64. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  65. Content="{TemplateBinding Content}"
  66. ContentTemplate="{TemplateBinding ContentTemplate}"
  67. TextElement.FontFamily="{TemplateBinding FontFamily}"
  68. TextElement.FontSize="{TemplateBinding FontSize}"
  69. TextElement.FontWeight="{TemplateBinding FontWeight}" />
  70. </Panel>
  71. </Border>
  72. </ControlTemplate>
  73. </Setter>
  74. <Style Selector="^:pointerover">
  75. <Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/>
  76. <Style Selector="^ /template/ Border#PART_LayoutRoot">
  77. <Setter Property="Background" Value="{DynamicResource HamburgerChromeLowColor}" />
  78. <Setter Property="BoxShadow" Value="{StaticResource NavigationItemShadow}" />
  79. <Setter Property="TextElement.Foreground" Value="{DynamicResource HamburgerBaseHighColor}" />
  80. </Style>
  81. </Style>
  82. <Style Selector="^:selected">
  83. <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
  84. <Style Selector="^ /template/ Border#PART_SelectedPipe">
  85. <Setter Property="IsVisible" Value="True" />
  86. </Style>
  87. </Style>
  88. <Style Selector="^:pressed /template/ Border#PART_LayoutRoot">
  89. <Setter Property="Border.Background" Value="{DynamicResource HamburgerChromeLowColor}" />
  90. <Setter Property="Border.BoxShadow" Value="{StaticResource NavigationItemShadow}" />
  91. <Setter Property="TextElement.Foreground" Value="{DynamicResource HamburgerBaseHighColor}" />
  92. </Style>
  93. </ControlTheme>
  94. </ResourceDictionary>