Kaynağa Gözat

fix: reverse TickBar when Slider direction is reversed (#19096)

yoyo 6 ay önce
ebeveyn
işleme
7cf3b0f9ae

+ 9 - 0
samples/ControlCatalog/Pages/SliderPage.xaml

@@ -21,6 +21,15 @@
                 IsSnapToTickEnabled="True"
                 Ticks="0,20,25,40,75,100"
                 Width="300" />
+        <Slider Name="ReversedTickedSlider"
+                Value="0"
+                Minimum="0"
+                Maximum="100"
+                TickPlacement="BottomRight"
+                IsSnapToTickEnabled="True"
+                IsDirectionReversed="True"
+                Ticks="0,20,25,40,75,100"
+                Width="300" />
         <Slider Name="SliderWithTooltip"
                 Value="0"
                 Minimum="0"

+ 5 - 1
src/Avalonia.Themes.Fluent/Controls/Slider.xaml

@@ -129,6 +129,7 @@
                         VerticalAlignment="Bottom"
                         Placement="Top" 
                         IsVisible="False"
+                        IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                         Fill="{DynamicResource SliderTickBarFill}"/>
                     <TickBar
                         Name="BottomTickBar"
@@ -144,6 +145,7 @@
                         VerticalAlignment="Top"
                         Placement="Bottom"
                         IsVisible="False"
+                        IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                         Fill="{DynamicResource SliderTickBarFill}" />
                     <Track
                         Name="PART_Track"
@@ -225,8 +227,9 @@
                         HorizontalAlignment="Right"
                         Placement="Left"
                         IsVisible="False"
+                        IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                         Fill="{DynamicResource SliderTickBarFill}"/>
-                    <TickBar
+                    <TickBar 
                         Name="RightTickBar"
                         Grid.RowSpan="3"
                         Grid.Column="2"
@@ -240,6 +243,7 @@
                         HorizontalAlignment="Left"
                         Placement="Right" 
                         IsVisible="False"
+                        IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
                         Fill="{DynamicResource SliderTickBarFill}"/>
                     <Track
                         Name="PART_Track"