Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbar fixes #873

Merged
merged 5 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions src/Wpf.Ui/Controls/DynamicScrollBar/DynamicScrollBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls"
xmlns:converters="clr-namespace:Wpf.Ui.Converters"
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<Duration x:Key="DynamicScrollAnimationDuration">0:0:0.16</Duration>
Expand All @@ -16,6 +15,7 @@
<Setter Property="Width" Value="{StaticResource DynamicLineButtonWidth}" />
<Setter Property="Height" Value="{StaticResource DynamicLineButtonHeight}" />
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="11" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Focusable" Value="False" />
Expand All @@ -34,7 +34,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Filled="True"
FontSize="12"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
Symbol="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
</Border>
Expand Down Expand Up @@ -112,6 +112,14 @@
<RowDefinition Height="0.00001*" />
<RowDefinition MaxHeight="14" />
</Grid.RowDefinitions>
<Border
x:Name="PART_Border"
Grid.RowSpan="3"
Width="12"
HorizontalAlignment="Center"
Background="{DynamicResource ScrollBarTrackFillPointerOver}"
CornerRadius="6"
Opacity="0" />
<RepeatButton
x:Name="PART_ButtonScrollUp"
Grid.Row="0"
Expand Down Expand Up @@ -158,7 +166,13 @@
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Width"
From="6"
To="10"
To="8"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Storyboard.TargetProperty="Opacity"
From="0.0"
To="1.0"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_ButtonScrollUp"
Expand All @@ -181,9 +195,15 @@
<DoubleAnimation
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Width"
From="10"
From="8"
To="6"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Storyboard.TargetProperty="Opacity"
From="1.0"
To="0.0"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_ButtonScrollUp"
Storyboard.TargetProperty="Opacity"
Expand Down Expand Up @@ -236,6 +256,14 @@
<ColumnDefinition Width="0.00001*" />
<ColumnDefinition MaxWidth="18" />
</Grid.ColumnDefinitions>
<Border
x:Name="PART_Border"
Grid.ColumnSpan="3"
Height="12"
VerticalAlignment="Center"
Background="{DynamicResource ScrollBarButtonBackground}"
CornerRadius="6"
Opacity="0" />

<RepeatButton
x:Name="PART_ButtonScrollLeft"
Expand Down Expand Up @@ -285,7 +313,13 @@
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Height"
From="6"
To="10"
To="8"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Storyboard.TargetProperty="Opacity"
From="0.0"
To="1.0"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_ButtonScrollLeft"
Expand All @@ -308,9 +342,15 @@
<DoubleAnimation
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Height"
From="10"
From="8"
To="6"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Storyboard.TargetProperty="Opacity"
From="1.0"
To="0.0"
Duration="{StaticResource DynamicScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_ButtonScrollLeft"
Storyboard.TargetProperty="Opacity"
Expand Down
21 changes: 11 additions & 10 deletions src/Wpf.Ui/Controls/ScrollBar/ScrollBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls"
xmlns:converters="clr-namespace:Wpf.Ui.Converters"
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<Duration x:Key="ScrollAnimationDuration">0:0:0.16</Duration>
Expand All @@ -22,7 +21,7 @@
<Setter Property="Foreground" Value="{DynamicResource ScrollBarButtonArrowForeground}" />
<Setter Property="Width" Value="{StaticResource LineButtonWidth}" />
<Setter Property="Height" Value="{StaticResource LineButtonHeight}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Margin" Value="0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
Expand Down Expand Up @@ -125,12 +124,13 @@
Grid.RowSpan="3"
Width="12"
HorizontalAlignment="Center"
Background="{DynamicResource ScrollBarButtonBackground}"
Background="{DynamicResource ScrollBarTrackFillPointerOver}"
CornerRadius="6"
Opacity="0" />
<RepeatButton
x:Name="PART_ButtonScrollUp"
Grid.Row="0"
HorizontalContentAlignment="Left"
Command="ScrollBar.LineUpCommand"
Content="{x:Static controls:SymbolRegular.CaretUp24}"
Opacity="0"
Expand Down Expand Up @@ -159,6 +159,7 @@
<RepeatButton
x:Name="PART_ButtonScrollDown"
Grid.Row="2"
HorizontalContentAlignment="Left"
Command="ScrollBar.LineDownCommand"
Content="{x:Static controls:SymbolRegular.CaretDown24}"
Opacity="0"
Expand All @@ -173,7 +174,7 @@
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Width"
From="6"
To="10"
To="8"
Duration="{StaticResource ScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Expand Down Expand Up @@ -202,7 +203,7 @@
<DoubleAnimation
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Width"
From="10"
From="8"
To="6"
Duration="{StaticResource ScrollAnimationDuration}" />
<DoubleAnimation
Expand Down Expand Up @@ -241,10 +242,10 @@
x:Name="PART_Border"
Grid.ColumnSpan="3"
Height="12"
Opacity="0"
Background="{DynamicResource ScrollBarButtonBackground}"
VerticalAlignment="Center"
CornerRadius="6"/>
Background="{DynamicResource ScrollBarButtonBackground}"
CornerRadius="6"
Opacity="0" />

<RepeatButton
x:Name="PART_ButtonScrollLeft"
Expand Down Expand Up @@ -291,7 +292,7 @@
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Height"
From="6"
To="10"
To="8"
Duration="{StaticResource ScrollAnimationDuration}" />
<DoubleAnimation
Storyboard.TargetName="PART_Border"
Expand Down Expand Up @@ -320,7 +321,7 @@
<DoubleAnimation
Storyboard.TargetName="PART_Track"
Storyboard.TargetProperty="Height"
From="10"
From="8"
To="6"
Duration="{StaticResource ScrollAnimationDuration}" />
<DoubleAnimation
Expand Down
11 changes: 8 additions & 3 deletions src/Wpf.Ui/Controls/ScrollViewer/ScrollViewer.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<!--
<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls">

<Style x:Key="UiScrollViewer" TargetType="{x:Type ScrollViewer}">
<Setter Property="Margin" Value="0" />
Expand Down Expand Up @@ -34,7 +37,9 @@
-->
<Grid
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="{TemplateBinding Padding}">
<ScrollContentPresenter CanContentScroll="{TemplateBinding CanContentScroll}" />
</Grid>
Expand Down Expand Up @@ -64,5 +69,5 @@
</Style>

<Style BasedOn="{StaticResource UiScrollViewer}" TargetType="{x:Type ScrollViewer}" />

<Style BasedOn="{StaticResource UiScrollViewer}" TargetType="{x:Type controls:PassiveScrollViewer}" />
</ResourceDictionary>
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/Dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="{StaticResource AcrylicBackgroundFillColorDefault}" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="{StaticResource SubtleFillColorTransparent}" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource ControlStrongFillColorDefault}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource ControlStrongFillColorDefault}" />
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/HC1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource SystemColorButtonTextColor}" />
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/HC2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource SystemColorButtonTextColor}" />
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/HCBlack.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource SystemColorButtonTextColor}" />
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/HCWhite.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource SystemColorButtonTextColor}" />
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Theme/Light.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
<!-- TODO -->

<!-- DynamicScrollBar -->
<SolidColorBrush x:Key="ScrollBarTrackFillPointerOver" Color="{StaticResource AcrylicBackgroundFillColorDefault}" />
<SolidColorBrush x:Key="ScrollBarButtonBackground" Color="{StaticResource SubtleFillColorTransparent}" />
<SolidColorBrush x:Key="ScrollBarButtonArrowForeground" Color="{StaticResource ControlStrongFillColorDefault}" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="{StaticResource ControlStrongFillColorDefault}" />
Expand Down
Loading