Browse Source

Merge pull request #2096 from wieslawsoltes/FixScrollBarTemplate

Fixes ScrollBar template hard-coded size values
pull/2123/head
Steven Kirk 8 years ago
committed by GitHub
parent
commit
5c27bb805c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Avalonia.Themes.Default/Accents/BaseDark.xaml
  2. 2
      src/Avalonia.Themes.Default/Accents/BaseLight.xaml
  3. 22
      src/Avalonia.Themes.Default/ScrollBar.xaml
  4. 2
      tests/Avalonia.Layout.UnitTests/FullLayoutTests.cs

2
src/Avalonia.Themes.Default/Accents/BaseDark.xaml

@ -52,5 +52,7 @@
<sys:Double x:Key="FontSizeSmall">10</sys:Double>
<sys:Double x:Key="FontSizeNormal">12</sys:Double>
<sys:Double x:Key="FontSizeLarge">16</sys:Double>
<sys:Double x:Key="ScrollBarThickness">10</sys:Double>
</Style.Resources>
</Style>

2
src/Avalonia.Themes.Default/Accents/BaseLight.xaml

@ -52,5 +52,7 @@
<sys:Double x:Key="FontSizeSmall">10</sys:Double>
<sys:Double x:Key="FontSizeNormal">12</sys:Double>
<sys:Double x:Key="FontSizeLarge">16</sys:Double>
<sys:Double x:Key="ScrollBarThickness">10</sys:Double>
</Style.Resources>
</Style>

22
src/Avalonia.Themes.Default/ScrollBar.xaml

@ -3,7 +3,7 @@
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource ThemeControlMidBrush}">
<Grid RowDefinitions="10,*,10">
<Grid RowDefinitions="Auto,*,Auto">
<RepeatButton Name="PART_LineUpButton"
Classes="repeat"
Grid.Row="0"
@ -53,12 +53,11 @@
</Setter>
</Style>
<Style Selector="ScrollBar:horizontal">
<Setter Property="Height"
Value="10" />
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource ThemeControlMidBrush}">
<Grid ColumnDefinitions="10,*,10">
<Grid ColumnDefinitions="Auto,*,Auto">
<RepeatButton Name="PART_LineUpButton"
Classes="repeat"
Grid.Row="0"
@ -108,22 +107,17 @@
</Setter>
</Style>
<Style Selector="ScrollBar:horizontal /template/ Thumb#thumb">
<Setter Property="MinWidth"
Value="10" />
<Setter Property="MinWidth" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="ScrollBar:vertical">
<Setter Property="Width"
Value="10" />
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="ScrollBar:vertical /template/ Thumb#thumb">
<Setter Property="MinHeight"
Value="10" />
<Setter Property="MinHeight" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="ScrollBar /template/ RepeatButton.repeat">
<Setter Property="Padding"
Value="2" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Padding" Value="2" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="ScrollBar /template/ RepeatButton.repeattrack">
<Setter Property="Template">

2
tests/Avalonia.Layout.UnitTests/FullLayoutTests.cs

@ -99,6 +99,8 @@ namespace Avalonia.Layout.UnitTests
}
};
window.Resources["ScrollBarThickness"] = 10.0;
window.Show();
window.LayoutManager.ExecuteInitialLayoutPass(window);

Loading…
Cancel
Save