enhance: Optimized the ScrollViewer style.

This commit is contained in:
NaBian 2024-07-27 21:32:20 +08:00
parent 17c2b8473b
commit 51f07648ee
16 changed files with 458 additions and 235 deletions

View File

@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.0.6</AvaloniaVersion>
<AvaloniaVersion>11.1.1</AvaloniaVersion>
</PropertyGroup>
</Project>

View File

@ -1,7 +1,7 @@
[
{
"title": "Styles",
"selectedIndex": -1,
"selectedIndex": 0,
"group": false,
"demoItemList": [
[ "Brush", "BrushDemoCtl", "Brush.Brush", "", "" ],

View File

@ -65,6 +65,10 @@
<DependentUpon>BorderDemoCtl.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="UserControl\Styles\RepeatButtonDemoCtl.axaml.cs">
<DependentUpon>RepeatButtonDemoCtl.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>

View File

@ -16,22 +16,21 @@ public class DataService
{
var infoList = new List<DemoInfoModel>();
string jsonStr = ReadEmbeddedJsonFile("HandyControlDemo.Data.DemoInfo.json");
var jsonObj = JsonConvert.DeserializeObject<dynamic>(jsonStr);
dynamic? jsonObj = JsonConvert.DeserializeObject<dynamic>(jsonStr);
if (jsonObj is null)
{
return new List<DemoInfoModel>();
return [];
}
foreach (var item in jsonObj)
foreach (dynamic? item in jsonObj)
{
var titleKey = (string) item.title;
var title = titleKey;
string? titleKey = (string) item.title;
List<DemoItemModel> list = Convert2DemoItemList(item.demoItemList);
var demoInfoModel = new DemoInfoModel
{
Key = titleKey,
Title = title,
Title = titleKey,
DemoItemList = list,
SelectedIndex = (int) item.selectedIndex,
IsGroupEnabled = (bool) item.group
@ -43,10 +42,10 @@ public class DataService
return infoList;
}
private string ReadEmbeddedJsonFile(string resourceName)
private static string ReadEmbeddedJsonFile(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceNameWithNamespace = assembly.GetManifestResourceNames()
string? resourceNameWithNamespace = assembly.GetManifestResourceNames()
.FirstOrDefault(n => n.EndsWith(resourceName, StringComparison.OrdinalIgnoreCase));
if (resourceNameWithNamespace is null)
@ -64,17 +63,17 @@ public class DataService
return reader.ReadToEnd();
}
private List<DemoItemModel> Convert2DemoItemList(dynamic list)
private static List<DemoItemModel> Convert2DemoItemList(dynamic list)
{
var resultList = new List<DemoItemModel>();
foreach (var item in list)
foreach (dynamic? item in list)
{
var name = (string) item[0];
string? name = (string) item[0];
string targetCtlName = item[1];
string imageBrushName = item[2];
var isNew = !string.IsNullOrEmpty((string) item[3]);
var groupName = (string) item[4];
bool isNew = !string.IsNullOrEmpty((string) item[3]);
string? groupName = (string) item[4];
if (string.IsNullOrEmpty(groupName))
{
groupName = "Misc";

View File

@ -0,0 +1,69 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="HandyControlDemo.UserControl.RepeatButtonDemoCtl"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
<ScrollViewer>
<hc:UniformSpacingPanel ChildWrapping="Wrap"
Spacing="32"
Margin="32">
<hc:UniformSpacingPanel Orientation="Vertical"
Spacing="32">
<WrapPanel>
<StackPanel>
<RepeatButton Content="default"
Margin="5" />
<RepeatButton IsEnabled="False"
Content="default"
Margin="5" />
</StackPanel>
<StackPanel>
<RepeatButton Content="primary"
Margin="5"
Theme="{StaticResource RepeatButtonPrimary}" />
<RepeatButton IsEnabled="False"
Content="primary"
Margin="5"
Theme="{StaticResource RepeatButtonPrimary}" />
</StackPanel>
<StackPanel>
<RepeatButton Content="success"
Margin="5"
Theme="{StaticResource RepeatButtonSuccess}" />
<RepeatButton IsEnabled="False"
Content="success"
Margin="5"
Theme="{StaticResource RepeatButtonSuccess}" />
</StackPanel>
<StackPanel>
<RepeatButton Content="info"
Margin="5"
Theme="{StaticResource RepeatButtonInfo}" />
<RepeatButton IsEnabled="False"
Content="info"
Margin="5"
Theme="{StaticResource RepeatButtonInfo}" />
</StackPanel>
<StackPanel>
<RepeatButton Content="warning"
Margin="5"
Theme="{StaticResource RepeatButtonWarning}" />
<RepeatButton IsEnabled="False"
Content="warning"
Margin="5"
Theme="{StaticResource RepeatButtonWarning}" />
</StackPanel>
<StackPanel>
<RepeatButton Content="danger"
Margin="5"
Theme="{StaticResource RepeatButtonDanger}" />
<RepeatButton IsEnabled="False"
Content="danger"
Margin="5"
Theme="{StaticResource RepeatButtonDanger}" />
</StackPanel>
</WrapPanel>
</hc:UniformSpacingPanel>
</hc:UniformSpacingPanel>
</ScrollViewer>
</UserControl>

View File

@ -0,0 +1,9 @@
namespace HandyControlDemo.UserControl;
public partial class RepeatButtonDemoCtl : Avalonia.Controls.UserControl
{
public RepeatButtonDemoCtl()
{
InitializeComponent();
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.Messaging;
using HandyControlDemo.Data;
@ -44,10 +45,11 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
private void UpdateMainContent()
{
WeakReferenceMessenger.Default.Register<DemoItemModel, string>(this, MessageToken.SwitchDemo, (_, message) =>
{
SwitchDemo(message);
});
WeakReferenceMessenger.Default.Register<DemoItemModel, string>(
recipient: this,
token: MessageToken.SwitchDemo,
handler: (_, message) => SwitchDemo(message)
);
}
private void UpdateLeftContent()
@ -76,11 +78,9 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
DemoInfoCollection = [];
foreach (var item in _dataService.GetDemoInfo())
{
Dispatcher.UIThread.InvokeAsync(() =>
{
DemoInfoCollection.Add(item);
}, DispatcherPriority.ApplicationIdle);
Dispatcher.UIThread.InvokeAsync(() => DemoInfoCollection.Add(item));
}
Dispatcher.UIThread.InvokeAsync(() => SwitchDemo(DemoInfoCollection.First().DemoItemList.First()));
}
private void SwitchDemo(DemoItemModel item)
@ -92,7 +92,8 @@ public class MainViewModel : DemoViewModelBase<DemoDataModel>
DemoItemCurrent = item;
ContentTitle = Lang.ResourceManager.GetString(item.Name, Lang.Culture);
object? demoControl = AssemblyHelper.ResolveByKey(item.TargetCtlName) ?? AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
object? demoControl = AssemblyHelper.ResolveByKey(item.TargetCtlName) ??
AssemblyHelper.CreateInternalInstance($"UserControl.{item.TargetCtlName}");
SubContent = demoControl;
}
}

View File

@ -6,7 +6,8 @@ namespace HandyControlDemo.ViewModel;
public class ViewModelLocator
{
private static readonly Lazy<ViewModelLocator> InstanceInternal = new(() => new ViewModelLocator(), isThreadSafe: true);
private static readonly Lazy<ViewModelLocator> InstanceInternal =
new(() => new ViewModelLocator(), isThreadSafe: true);
public static ViewModelLocator Instance => InstanceInternal.Value;

View File

@ -0,0 +1,124 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="RepeatButtonBaseStyle"
TargetType="RepeatButton">
<Setter Property="Height"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Padding"
Value="{StaticResource DefaultControlPadding}" />
<Setter Property="HorizontalAlignment"
Value="Center" />
<Setter Property="VerticalAlignment"
Value="Center" />
<Setter Property="HorizontalContentAlignment"
Value="Center" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource TextIconBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="CornerRadius"
Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter x:Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
RecognizesAccessKey="True"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Opacity"
Value="0.9" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Opacity"
Value="0.6" />
</Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Opacity"
Value="0.4" />
</Style>
</ControlTheme>
<ControlTheme x:Key="RepeatButtonDefault"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Foreground"
Value="{DynamicResource PrimaryTextBrush}" />
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background"
Value="{DynamicResource SecondaryRegionBrush}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background"
Value="{DynamicResource BorderBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type RepeatButton}"
BasedOn="{StaticResource RepeatButtonDefault}"
TargetType="RepeatButton" />
<ControlTheme x:Key="RepeatButtonPrimary"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Background"
Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource PrimaryBrush}" />
</ControlTheme>
<ControlTheme x:Key="RepeatButtonSuccess"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Background"
Value="{DynamicResource SuccessBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource SuccessBrush}" />
</ControlTheme>
<ControlTheme x:Key="RepeatButtonInfo"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Background"
Value="{DynamicResource InfoBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource InfoBrush}" />
</ControlTheme>
<ControlTheme x:Key="RepeatButtonWarning"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Background"
Value="{DynamicResource WarningBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource WarningBrush}" />
</ControlTheme>
<ControlTheme x:Key="RepeatButtonDanger"
BasedOn="{StaticResource RepeatButtonBaseStyle}"
TargetType="RepeatButton">
<Setter Property="Background"
Value="{DynamicResource DangerBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource DangerBrush}" />
</ControlTheme>
</ResourceDictionary>

View File

@ -1,173 +0,0 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="{x:Type ScrollBar}"
TargetType="ScrollBar">
<Setter Property="Cursor"
Value="Arrow" />
<Style Selector="^:horizontal">
<Setter Property="Height"
Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource ThemeControlMidBrush}"
UseLayoutRounding="False">
<Grid ColumnDefinitions="Auto,*,Auto"
RowDefinitions="*,*,*">
<RepeatButton Name="PART_LineUpButton"
Grid.Row="0"
Grid.Column="0"
MinWidth="{DynamicResource ScrollBarThickness}"
VerticalAlignment="Center"
Classes="repeat"
Focusable="False">
<Path Data="M 4 0 L 4 8 L 0 4 Z" />
</RepeatButton>
<Track Grid.Row="1"
Grid.Column="1"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="{TemplateBinding Orientation}"
ViewportSize="{TemplateBinding ViewportSize}"
DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton Name="PART_PageUpButton"
Classes="repeattrack"
Focusable="False" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_PageDownButton"
Classes="repeattrack"
Focusable="False" />
</Track.IncreaseButton>
<Thumb Name="thumb" />
</Track>
<RepeatButton Name="PART_LineDownButton"
Grid.Row="2"
Grid.Column="2"
MinWidth="{DynamicResource ScrollBarThickness}"
VerticalAlignment="Center"
Classes="repeat"
Focusable="False">
<Path Data="M 0 0 L 4 4 L 0 8 Z" />
</RepeatButton>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^:vertical">
<Setter Property="Width"
Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource ThemeControlMidBrush}"
UseLayoutRounding="False">
<Grid RowDefinitions="Auto,*,Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<RepeatButton Name="PART_LineUpButton"
Grid.Row="0"
MinHeight="{DynamicResource ScrollBarThickness}"
HorizontalAlignment="Center"
Classes="repeat"
Focusable="False">
<Path Data="M 0 4 L 8 4 L 4 0 Z" />
</RepeatButton>
<Track Grid.Row="1"
Grid.Column="1"
IsDirectionReversed="True"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="{TemplateBinding Orientation}"
ViewportSize="{TemplateBinding ViewportSize}"
DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton Name="PART_PageUpButton"
Classes="repeattrack"
Focusable="False" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_PageDownButton"
Classes="repeattrack"
Focusable="False" />
</Track.IncreaseButton>
<Thumb Name="thumb" />
</Track>
<RepeatButton Name="PART_LineDownButton"
Grid.Row="2"
Grid.Column="2"
MinHeight="{DynamicResource ScrollBarThickness}"
HorizontalAlignment="Center"
Classes="repeat"
Focusable="False">
<Path Data="M 0 0 L 4 4 L 8 0 Z" />
</RepeatButton>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^ /template/ Thumb#thumb">
<Setter Property="Background"
Value="{DynamicResource ThemeControlMidHighBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="{TemplateBinding Background}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style Selector="^ /template/ Thumb#thumb:pointerover">
<Setter Property="Background"
Value="{DynamicResource ThemeControlHighBrush}" />
</Style>
<Style Selector="^ /template/ Thumb#thumb:pressed">
<Setter Property="Background"
Value="{DynamicResource ThemeControlVeryHighBrush}" />
</Style>
<Style Selector="^:horizontal /template/ Thumb#thumb">
<Setter Property="MinWidth"
Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Height"
Value="{DynamicResource ScrollBarThumbThickness}" />
</Style>
<Style Selector="^:vertical /template/ Thumb#thumb">
<Setter Property="MinHeight"
Value="{DynamicResource ScrollBarThickness}" />
<Setter Property="Width"
Value="{DynamicResource ScrollBarThumbThickness}" />
</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="{TemplateBinding Background}" />
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^ /template/ RepeatButton > Path">
<Setter Property="Fill"
Value="{DynamicResource ThemeForegroundLowBrush}" />
</Style>
<Style Selector="^ /template/ RepeatButton:pointerover > Path">
<Setter Property="Fill"
Value="{DynamicResource ThemeAccentBrush}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -1,5 +1,189 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTheme x:Key="ScrollBarBaseRepeatButton"
TargetType="RepeatButton">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Focusable"
Value="false" />
<Setter Property="IsTabStop"
Value="false" />
<Setter Property="Template">
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}"
Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}" />
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="ScrollBarBaseThumbVertical"
TargetType="Thumb">
<Setter Property="Background"
Value="{DynamicResource SecondaryTextBrush}" />
<Setter Property="IsTabStop"
Value="false" />
<Setter Property="Template">
<ControlTemplate>
<Border Width="{TemplateBinding Width}"
Background="Transparent">
<Rectangle x:Name="rectangle"
RadiusX="1"
RadiusY="1"
HorizontalAlignment="Center"
Height="{TemplateBinding Height}"
Width="2"
Fill="{TemplateBinding Background}">
<Rectangle.Transitions>
<Transitions>
<DoubleTransition Property="Width"
Duration="0:0:0.1" />
<DoubleTransition Property="RadiusX"
Duration="0:0:0.1" />
<DoubleTransition Property="RadiusY"
Duration="0:0:0.1" />
</Transitions>
</Rectangle.Transitions>
</Rectangle>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Rectangle">
<Setter Property="Width"
Value="8" />
<Setter Property="RadiusX"
Value="4" />
<Setter Property="RadiusY"
Value="4" />
</Style>
<Style Selector="^:pressed /template/ Rectangle">
<Setter Property="Fill"
Value="{DynamicResource PrimaryTextBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ScrollBarBaseThumbHorizontal"
TargetType="Thumb">
<Setter Property="Background"
Value="{DynamicResource SecondaryTextBrush}" />
<Setter Property="IsTabStop"
Value="false" />
<Setter Property="Template">
<ControlTemplate>
<Border Width="{TemplateBinding Height}"
Background="Transparent">
<Rectangle x:Name="rectangle"
RadiusX="1"
RadiusY="1"
VerticalAlignment="Center"
Height="2"
Width="{TemplateBinding Width}"
Fill="{TemplateBinding Background}">
<Rectangle.Transitions>
<Transitions>
<DoubleTransition Property="Height"
Duration="0:0:0.1" />
<DoubleTransition Property="RadiusX"
Duration="0:0:0.1" />
<DoubleTransition Property="RadiusY"
Duration="0:0:0.1" />
</Transitions>
</Rectangle.Transitions>
</Rectangle>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Rectangle">
<Setter Property="Height"
Value="8" />
<Setter Property="RadiusX"
Value="4" />
<Setter Property="RadiusY"
Value="4" />
</Style>
<Style Selector="^:pressed /template/ Rectangle">
<Setter Property="Fill"
Value="{DynamicResource PrimaryTextBrush}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="ScrollBarBaseStyle"
TargetType="ScrollBar">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Focusable"
Value="False" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="MinHeight"
Value="8" />
<Setter Property="MinWidth"
Value="8" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity"
Duration="0:0:0.1" />
</Transitions>
</Setter>
<Style Selector="^:horizontal">
<Setter Property="Template">
<ControlTemplate>
<Panel>
<Border Background="{TemplateBinding Background}" />
<Track Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="{TemplateBinding Orientation}"
ViewportSize="{TemplateBinding ViewportSize}"
DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Value="{TemplateBinding Value, Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton Name="PART_PageUpButton"
Theme="{StaticResource ScrollBarBaseRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_PageDownButton"
Theme="{StaticResource ScrollBarBaseRepeatButton}" />
</Track.IncreaseButton>
<Thumb Theme="{StaticResource ScrollBarBaseThumbHorizontal}" />
</Track>
</Panel>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^:vertical">
<Setter Property="Template">
<ControlTemplate>
<Panel>
<Border Background="{TemplateBinding Background}" />
<Track IsDirectionReversed="True"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="{TemplateBinding Orientation}"
ViewportSize="{TemplateBinding ViewportSize}"
DeferThumbDrag="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Value="{TemplateBinding Value, Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton Name="PART_PageUpButton"
Theme="{StaticResource ScrollBarBaseRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton Name="PART_PageDownButton"
Theme="{StaticResource ScrollBarBaseRepeatButton}" />
</Track.IncreaseButton>
<Thumb Theme="{StaticResource ScrollBarBaseThumbVertical}" />
</Track>
</Panel>
</ControlTemplate>
</Setter>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type ScrollViewer}"
TargetType="ScrollViewer">
<Setter Property="Background"
@ -9,6 +193,8 @@
<Grid ColumnDefinitions="*,Auto"
RowDefinitions="*,Auto">
<ScrollContentPresenter Name="PART_ContentPresenter"
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Padding="{TemplateBinding Padding}"
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}"
@ -25,16 +211,22 @@
<ScrollBar Name="PART_HorizontalScrollBar"
Grid.Row="1"
Grid.Column="0"
Opacity=".3"
Theme="{StaticResource ScrollBarBaseStyle}"
Orientation="Horizontal" />
<ScrollBar Name="PART_VerticalScrollBar"
Grid.Row="0"
Grid.Column="1"
Opacity="0"
Theme="{StaticResource ScrollBarBaseStyle}"
Orientation="Vertical" />
<Panel Grid.Row="1"
Grid.Column="1"
Background="{DynamicResource ThemeControlMidBrush}" />
</Grid>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ ScrollBar">
<Setter Property="Opacity"
Value=".8" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -9,14 +9,14 @@
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/UserControl.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Window.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Button.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/RepeatButton.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Border.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ItemsControl.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabItem.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TabControl.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ListBoxItem.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ListBox.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ScrollBar.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ScrollViewer.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/ListBox.axaml" />
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/Label.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -48,72 +48,72 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HandyControlDemo_Avalonia",
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug-Avalonia|Any CPU = Debug-Avalonia|Any CPU
Debug-Net40|Any CPU = Debug-Net40|Any CPU
Release|Any CPU = Release|Any CPU
Debug-Net-GE45|Any CPU = Debug-Net-GE45|Any CPU
Release-Avalonia|Any CPU = Release-Avalonia|Any CPU
Release-Net40|Any CPU = Release-Net40|Any CPU
Release-Net-GE45|Any CPU = Release-Net-GE45|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release|Any CPU.Build.0 = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net-GE45|Any CPU.Build.0 = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net-GE45|Any CPU.Build.0 = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net-GE45|Any CPU.Build.0 = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net-GE45|Any CPU.Build.0 = Release|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Debug-Net40|Any CPU.Build.0 = Debug|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Release-Net40|Any CPU.Build.0 = Release|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32204503-2EF0-4681-AE13-AA1FEB6C658A}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Debug-Net40|Any CPU.Build.0 = Debug|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Release-Net40|Any CPU.Build.0 = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8AE88F8-C36B-4D10-A7F9-22FFCFBA5231}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug-Net40|Any CPU.Build.0 = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release|Any CPU.Build.0 = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Debug-Net-GE45|Any CPU.Build.0 = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release-Net40|Any CPU.Build.0 = Release|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{D8A4748C-0500-4F63-BC47-3506658C68F7}.Release-Net-GE45|Any CPU.Build.0 = Release|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Debug-Avalonia|Any CPU.Build.0 = Debug|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Release-Avalonia|Any CPU.Build.0 = Release|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34D39209-C744-41AA-91D6-C15C68E2A1D9}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Debug-Avalonia|Any CPU.ActiveCfg = Debug|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Debug-Avalonia|Any CPU.Build.0 = Debug|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Debug-Net40|Any CPU.ActiveCfg = Debug|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Debug-Net-GE45|Any CPU.ActiveCfg = Debug|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Release-Avalonia|Any CPU.ActiveCfg = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Release-Avalonia|Any CPU.Build.0 = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Release-Net40|Any CPU.ActiveCfg = Release|Any CPU
{99CCAF7C-F9A1-4C54-A5F0-B231E7F7AE66}.Release-Net-GE45|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -2145,10 +2145,9 @@
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinWidth" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="MinHeight" Value="8" />
<Setter Property="BorderThickness" Value="0,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">

View File

@ -79,7 +79,7 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ScrollBarBaseThumbHorizontal" TargetType="Thumb">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
@ -176,10 +176,9 @@
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="MinWidth" Value="8"/>
<Setter Property="Height" Value="8"/>
<Setter Property="MinHeight" Value="8"/>
<Setter Property="BorderThickness" Value="0,1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
@ -391,7 +390,7 @@
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ScrollViewerBaseStyle" TargetType="hc:ScrollViewer">
<Setter Property="VerticalScrollBarVisibility" Value="{Binding Path=(hc:ScrollViewer.VerticalScrollBarVisibility),RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Focusable" Value="False"/>

View File

@ -2145,10 +2145,9 @@
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinWidth" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="MinHeight" Value="8" />
<Setter Property="BorderThickness" Value="0,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
@ -10839,8 +10838,8 @@
<RowDefinition x:Name="RowDefinition0" Height="Auto" />
<RowDefinition x:Name="RowDefinition1" Height="*" />
</Grid.RowDefinitions>
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" />
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" Grid.Row="1">
<TabPanel x:Name="headerPanel" Background="Transparent" IsItemsHost="true" Margin="0" Grid.Row="0" />
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Row="1">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>