<ResourceDictionary
    x:ClassModifier="internal"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ControlTheme TargetType="ScrollBar" x:Key="MainScrollbar">
        <Setter Property="Cursor" Value="Arrow" />

        <Style Selector="^:horizontal">
            <Setter Property="Height" Value="18" />
            <Setter Property="Focusable" Value="False" />
            <Setter Property="Template">
                <ControlTemplate>
                    <Border
                        Background="{DynamicResource WindowButtonBackgroundColor}"
                        Name="PART_Track"
                        UseLayoutRounding="False">
                        <Grid ColumnDefinitions="Auto,*,Auto">
                            <RepeatButton
                                Background="Transparent"
                                Classes="repeat"
                                Focusable="False"
                                Grid.Column="0"
                                Grid.Row="0"
                                Height="16"
                                Interval="55"
                                MinWidth="30"
                                Name="PART_LineUpButton"
                                VerticalAlignment="Center"
                                Width="16">
                                <Path
                                    Data="{StaticResource FilledArrowLeftGeometry}"
                                    Fill="{TemplateBinding Foreground}"
                                    Height="12"
                                    HorizontalAlignment="Center"
                                    Stretch="Fill"
                                    VerticalAlignment="Center"
                                    Width="12" />
                            </RepeatButton>
                            <Track
                                DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                Grid.Column="1"
                                Grid.Row="1"
                                Maximum="{TemplateBinding Maximum}"
                                Minimum="{TemplateBinding Minimum}"
                                Orientation="{TemplateBinding Orientation}"
                                Value="{TemplateBinding Value,
                                                        Mode=TwoWay}"
                                ViewportSize="{TemplateBinding ViewportSize}">
                                <Track.DecreaseButton>
                                    <RepeatButton
                                        Background="Transparent"
                                        Classes="repeattrack"
                                        Focusable="False"
                                        Interval="55"
                                        Name="PART_PageUpButton" />
                                </Track.DecreaseButton>
                                <Track.IncreaseButton>
                                    <RepeatButton
                                        Background="Transparent"
                                        Classes="repeattrack"
                                        Focusable="False"
                                        Interval="55"
                                        Name="PART_PageDownButton" />
                                </Track.IncreaseButton>
                                <Thumb Name="thumb" />
                            </Track>
                            <RepeatButton
                                Background="Transparent"
                                Classes="repeat"
                                Focusable="False"
                                Grid.Column="2"
                                Height="16"
                                Interval="55"
                                MinWidth="30"
                                Name="PART_LineDownButton"
                                VerticalAlignment="Center"
                                Width="16">
                                <Path
                                    Data="{StaticResource FilledArrowRightGeometry}"
                                    Fill="{TemplateBinding Foreground}"
                                    Height="12"
                                    HorizontalAlignment="Center"
                                    Stretch="Fill"
                                    VerticalAlignment="Center"
                                    Width="12" />
                            </RepeatButton>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter>
        </Style>

        <Style Selector="^:vertical">
            <Setter Property="Width" Value="30" />
            <Setter Property="Template">
                <ControlTemplate>
                    <Border
                        Background="{DynamicResource WindowButtonBackgroundColor}"
                        BorderBrush="{DynamicResource MainBorderColor}"
                        BorderThickness="1,0,0,0"
                        UseLayoutRounding="False">
                        <Grid RowDefinitions="Auto,*,Auto">
                            <RepeatButton
                                Background="Transparent"
                                Classes="repeat"
                                Focusable="False"
                                Grid.Row="0"
                                HorizontalAlignment="Center"
                                Interval="55"
                                MinHeight="{StaticResource ScrollBarThickness}"
                                Name="PART_LineUpButton">
                                <Path
                                    Data="{StaticResource FilledArrowUpGeometry}"
                                    Fill="{TemplateBinding Foreground}"
                                    Height="16"
                                    HorizontalAlignment="Center"
                                    Stretch="Fill"
                                    VerticalAlignment="Center"
                                    Width="16" />
                            </RepeatButton>
                            <Track
                                DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                Grid.Column="1"
                                Grid.Row="1"
                                IsDirectionReversed="True"
                                Maximum="{TemplateBinding Maximum}"
                                Minimum="{TemplateBinding Minimum}"
                                Orientation="{TemplateBinding Orientation}"
                                Value="{TemplateBinding Value,
                                                        Mode=TwoWay}"
                                ViewportSize="{TemplateBinding ViewportSize}">
                                <Track.DecreaseButton>
                                    <RepeatButton
                                        Background="Transparent"
                                        Classes="repeattrack"
                                        Focusable="False"
                                        Interval="55"
                                        Name="PART_PageUpButton" />
                                </Track.DecreaseButton>
                                <Track.IncreaseButton>
                                    <RepeatButton
                                        Background="Transparent"
                                        Classes="repeattrack"
                                        Focusable="False"
                                        Interval="55"
                                        Name="PART_PageDownButton" />
                                </Track.IncreaseButton>
                                <Thumb Name="thumb" />
                            </Track>
                            <RepeatButton
                                Background="Transparent"
                                Classes="repeat"
                                Focusable="False"
                                Grid.Column="2"
                                Grid.Row="2"
                                HorizontalAlignment="Center"
                                Interval="55"
                                MinHeight="{StaticResource ScrollBarThickness}"
                                Name="PART_LineDownButton">
                                <Path
                                    Data="{StaticResource FilledArrowDownGeometry}"
                                    Fill="{TemplateBinding Foreground}"
                                    Height="16"
                                    HorizontalAlignment="Center"
                                    Stretch="Fill"
                                    VerticalAlignment="Center"
                                    Width="16" />
                            </RepeatButton>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter>
        </Style>

        <Style Selector="^ /template/ Thumb#thumb">
            <Setter Property="Background" Value="{DynamicResource MainBackgroundColor}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border
                            Background="{TemplateBinding Background}"
                            BorderBrush="{DynamicResource TertiaryBorderColor}"
                            BorderThickness="1" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style Selector="^ /template/ Thumb#thumb:pointerover">
            <Setter Property="Background" Value="{DynamicResource AccentColor}" />
        </Style>
        <Style Selector="^ /template/ Thumb#thumb:pressed">
            <Setter Property="Background" Value="{DynamicResource SecondaryAccentColor}" />
        </Style>
        <Style Selector="^:horizontal /template/ Thumb#thumb">
            <Setter Property="MinWidth" Value="{StaticResource ScrollBarThickness}" />
            <Setter Property="Height" Value="16" />
        </Style>
        <Style Selector="^:vertical /template/ Thumb#thumb">
            <Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" />
            <Setter Property="Width" Value="16" />
        </Style>
        <Style Selector="^ /template/ RepeatButton.repeat">
            <Setter Property="Padding" Value="2" />
            <Setter Property="BorderThickness" Value="0" />
        </Style>
        <Style Selector="^ /template/ RepeatButton.repeattrack">
            <Setter Property="Template">
                <ControlTemplate>
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter>
        </Style>

        <Style Selector="^ /template/ RepeatButton &gt; Path">
            <Setter Property="Fill" Value="{TemplateBinding Foreground}" />
        </Style>

        <Style Selector="^ /template/ RepeatButton:pointerover &gt; Path">
            <Setter Property="Fill" Value="{DynamicResource AccentColor}" />
        </Style>
    </ControlTheme>
</ResourceDictionary>