Styles.axaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:id="clr-namespace:Avalonia.Xaml.Interactions.Draggable;assembly=Avalonia.Xaml.Interactions.Draggable">
  4. <!-- TabControl Drag Styles - Non Virtualizing -->
  5. <Style Selector=":is(TabControl).draggable">
  6. <Setter Property="ItemsPanel">
  7. <ItemsPanelTemplate>
  8. <StackPanel Orientation="Horizontal" />
  9. </ItemsPanelTemplate>
  10. </Setter>
  11. </Style>
  12. <Style Selector=":is(TabControl).draggable > :is(TabItem)">
  13. <Setter Property="ZIndex" Value="0" />
  14. <Setter Property="(Interaction.Behaviors)">
  15. <BehaviorCollectionTemplate>
  16. <BehaviorCollection>
  17. <ItemDragBehavior HorizontalDragThreshold="3" VerticalDragThreshold="3" />
  18. </BehaviorCollection>
  19. </BehaviorCollectionTemplate>
  20. </Setter>
  21. </Style>
  22. <Style Selector=":is(TabControl).draggable > :is(TabItem):pressed">
  23. <Setter Property="ZIndex" Value="1" />
  24. </Style>
  25. <!-- TabControl Drag Styles - Virtualizing -->
  26. <Style Selector=":is(TabControl).draggableVirtualizing">
  27. <Setter Property="ItemsPanel">
  28. <ItemsPanelTemplate>
  29. <VirtualizingStackPanel Orientation="Horizontal" />
  30. </ItemsPanelTemplate>
  31. </Setter>
  32. </Style>
  33. <Style Selector=":is(TabControl).draggableVirtualizing > :is(TabItem)">
  34. <Setter Property="ZIndex" Value="0" />
  35. <Setter Property="(Interaction.Behaviors)">
  36. <BehaviorCollectionTemplate>
  37. <BehaviorCollection>
  38. <ItemDragBehavior HorizontalDragThreshold="3" VerticalDragThreshold="3" />
  39. </BehaviorCollection>
  40. </BehaviorCollectionTemplate>
  41. </Setter>
  42. </Style>
  43. <Style Selector=":is(TabControl).draggableVirtualizing > :is(TabItem):pressed">
  44. <Setter Property="ZIndex" Value="1" />
  45. </Style>
  46. <!-- ItemsPanel Drag Styles - Non Virtualizing -->
  47. <Style Selector=":is(ListBox).draggable">
  48. <Setter Property="ItemsPanel">
  49. <Setter.Value>
  50. <ItemsPanelTemplate>
  51. <StackPanel Orientation="Vertical" />
  52. </ItemsPanelTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. </Style>
  56. <Style Selector=":is(ListBox).draggable > :is(ListBoxItem)">
  57. <Setter Property="ZIndex" Value="0" />
  58. <Setter Property="(Interaction.Behaviors)">
  59. <BehaviorCollectionTemplate>
  60. <BehaviorCollection>
  61. <ItemDragBehavior HorizontalDragThreshold="3" VerticalDragThreshold="3" Orientation="Vertical" />
  62. </BehaviorCollection>
  63. </BehaviorCollectionTemplate>
  64. </Setter>
  65. </Style>
  66. <Style Selector=":is(ListBox).draggable > :is(ListBoxItem):pressed">
  67. <Setter Property="ZIndex" Value="1" />
  68. </Style>
  69. <!-- ListBox Drag Styles - Virtualizing -->
  70. <Style Selector=":is(ListBox).draggableVirtualizing">
  71. <Setter Property="ItemsPanel">
  72. <Setter.Value>
  73. <ItemsPanelTemplate>
  74. <VirtualizingStackPanel Orientation="Vertical" />
  75. </ItemsPanelTemplate>
  76. </Setter.Value>
  77. </Setter>
  78. </Style>
  79. <Style Selector=":is(ListBox).draggableVirtualizing > :is(ListBoxItem)">
  80. <Setter Property="ZIndex" Value="0" />
  81. <Setter Property="(Interaction.Behaviors)">
  82. <BehaviorCollectionTemplate>
  83. <BehaviorCollection>
  84. <ItemDragBehavior HorizontalDragThreshold="3" VerticalDragThreshold="3" Orientation="Vertical" />
  85. </BehaviorCollection>
  86. </BehaviorCollectionTemplate>
  87. </Setter>
  88. </Style>
  89. <Style Selector=":is(ListBox).draggableVirtualizing > :is(ListBoxItem):pressed">
  90. <Setter Property="ZIndex" Value="1" />
  91. </Style>
  92. <!-- Canvas Drag Styles -->
  93. <Style Selector=":is(Canvas).draggable > :is(Control)">
  94. <Setter Property="(Interaction.Behaviors)">
  95. <BehaviorCollectionTemplate>
  96. <BehaviorCollection>
  97. <CanvasDragBehavior />
  98. </BehaviorCollection>
  99. </BehaviorCollectionTemplate>
  100. </Setter>
  101. </Style>
  102. <!-- ItemsControl Canvas Drag Styles -->
  103. <Style Selector=":is(ItemsControl).draggable > :is(ContentPresenter)">
  104. <Setter Property="(Interaction.Behaviors)">
  105. <BehaviorCollectionTemplate>
  106. <BehaviorCollection>
  107. <CanvasDragBehavior />
  108. </BehaviorCollection>
  109. </BehaviorCollectionTemplate>
  110. </Setter>
  111. </Style>
  112. <!-- Grid Drag Styles -->
  113. <Style Selector=":is(Grid).draggable > :is(Control)">
  114. <Setter Property="(Interaction.Behaviors)">
  115. <BehaviorCollectionTemplate>
  116. <BehaviorCollection>
  117. <GridDragBehavior CopyColumn="True" CopyRow="True" CopyColumnSpan="True" CopyRowSpan="True" />
  118. </BehaviorCollection>
  119. </BehaviorCollectionTemplate>
  120. </Setter>
  121. </Style>
  122. </Styles>