TabControl.axaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <ControlTheme x:Key="SukiTabControlStyle" TargetType="TabControl">
  3. <Setter Property="Margin" Value="0" />
  4. <Setter Property="Padding" Value="{DynamicResource TabItemMargin}" />
  5. <Setter Property="Background" Value="{DynamicResource TabControlBackground}" />
  6. <Setter Property="Template">
  7. <ControlTemplate>
  8. <Border HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  9. VerticalAlignment="{TemplateBinding VerticalAlignment}"
  10. Background="{TemplateBinding Background}"
  11. BorderBrush="{TemplateBinding BorderBrush}"
  12. BorderThickness="{TemplateBinding BorderThickness}"
  13. CornerRadius="{TemplateBinding CornerRadius}">
  14. <DockPanel>
  15. <LayoutTransformControl Name="PART_LayoutTransform" DockPanel.Dock="{TemplateBinding TabStripPlacement}">
  16. <ItemsPresenter Name="PART_ItemsPresenter" ItemsPanel="{TemplateBinding ItemsPanel}" />
  17. </LayoutTransformControl>
  18. <ContentPresenter Name="PART_SelectedContentHost"
  19. Margin="{TemplateBinding Padding}"
  20. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  21. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  22. Content="{TemplateBinding SelectedContent}"
  23. ContentTemplate="{TemplateBinding SelectedContentTemplate}" />
  24. </DockPanel>
  25. </Border>
  26. </ControlTemplate>
  27. </Setter>
  28. <Style Selector="^[TabStripPlacement=Left] /template/ LayoutTransformControl#PART_LayoutTransform">
  29. <Setter Property="LayoutTransform" Value="rotate(-90deg)" />
  30. <Style Selector="^ ItemsPresenter#PART_ItemsPresenter WrapPanel">
  31. <Setter Property="Orientation" Value="Horizontal" />
  32. <Setter Property="FlowDirection" Value="{DynamicResource FlowDirectionOpposite}" />
  33. </Style>
  34. </Style>
  35. <Style Selector="^[TabStripPlacement=Right] /template/ LayoutTransformControl#PART_LayoutTransform">
  36. <Setter Property="LayoutTransform" Value="rotate(90deg)" />
  37. <Style Selector="^ ItemsPresenter#PART_ItemsPresenter WrapPanel">
  38. <Setter Property="Orientation" Value="Horizontal" />
  39. </Style>
  40. </Style>
  41. <Style Selector="^[TabStripPlacement=Top] /template/ ItemsPresenter#PART_ItemsPresenter">
  42. <Setter Property="Margin" Value="{DynamicResource TabControlTopPlacementItemMargin}" />
  43. </Style>
  44. <Style Selector="^.HorizontalTabs">
  45. <Style Selector="^[TabStripPlacement=Left] /template/ LayoutTransformControl#PART_LayoutTransform">
  46. <Setter Property="LayoutTransform" Value="rotate(0)" />
  47. <Style Selector="^ ItemsPresenter#PART_ItemsPresenter WrapPanel">
  48. <Setter Property="Orientation" Value="Vertical" />
  49. <Setter Property="FlowDirection" Value="{DynamicResource FlowDirectionOpposite}" />
  50. </Style>
  51. </Style>
  52. <Style Selector="^[TabStripPlacement=Right] /template/ LayoutTransformControl#PART_LayoutTransform">
  53. <Setter Property="LayoutTransform" Value="rotate(0)" />
  54. <Style Selector="^ ItemsPresenter#PART_ItemsPresenter WrapPanel">
  55. <Setter Property="Orientation" Value="Vertical" />
  56. </Style>
  57. </Style>
  58. </Style>
  59. </ControlTheme>
  60. <ControlTheme x:Key="{x:Type TabControl}"
  61. BasedOn="{StaticResource SukiTabControlStyle}"
  62. TargetType="TabControl" />
  63. </ResourceDictionary>