From c4f49765b833a0cbbf4bd62cf10b51b60181faee Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 21 Jun 2023 20:12:43 +0800 Subject: [PATCH] feat: update light theme. --- demo/Ursa.Demo/Pages/PaginationDemo.axaml | 2 +- .../ViewModels/PaginationDemoViewModel.cs | 1 + .../Controls/Pagination.axaml | 53 +++++++++++++++---- .../Themes/Light/Pagination.axaml | 7 +++ .../Themes/Shared/Pagination.axaml | 1 + src/Ursa/Controls/Pagination/Pagination.cs | 36 ++++++++++--- .../Controls/Pagination/PaginationButton.cs | 10 ++-- 7 files changed, 85 insertions(+), 25 deletions(-) diff --git a/demo/Ursa.Demo/Pages/PaginationDemo.axaml b/demo/Ursa.Demo/Pages/PaginationDemo.axaml index ab087ef..32cd9bd 100644 --- a/demo/Ursa.Demo/Pages/PaginationDemo.axaml +++ b/demo/Ursa.Demo/Pages/PaginationDemo.axaml @@ -16,7 +16,7 @@ diff --git a/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs index e85fd3e..bf69393 100644 --- a/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs +++ b/demo/Ursa.Demo/ViewModels/PaginationDemoViewModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Collections.ObjectModel; using Avalonia.Collections; using CommunityToolkit.Mvvm.ComponentModel; diff --git a/src/Ursa.Themes.Semi/Controls/Pagination.axaml b/src/Ursa.Themes.Semi/Controls/Pagination.axaml index 039c857..c5564d6 100644 --- a/src/Ursa.Themes.Semi/Controls/Pagination.axaml +++ b/src/Ursa.Themes.Semi/Controls/Pagination.axaml @@ -16,17 +16,20 @@ + Data="{DynamicResource PaginationBackwardGlyph}" + Foreground="{DynamicResource PaginationButtonIconForeground}" /> + Data="{DynamicResource PaginationForwardGlyph}" + Foreground="{DynamicResource PaginationButtonIconForeground}" /> @@ -38,12 +41,15 @@ - + + + + + Content="{TemplateBinding Content}" + FontWeight="{TemplateBinding FontWeight}" + Foreground="{TemplateBinding Foreground}" /> + diff --git a/src/Ursa.Themes.Semi/Themes/Light/Pagination.axaml b/src/Ursa.Themes.Semi/Themes/Light/Pagination.axaml index 9017e8d..31ddae8 100644 --- a/src/Ursa.Themes.Semi/Themes/Light/Pagination.axaml +++ b/src/Ursa.Themes.Semi/Themes/Light/Pagination.axaml @@ -1,3 +1,10 @@ + + + + + + + diff --git a/src/Ursa.Themes.Semi/Themes/Shared/Pagination.axaml b/src/Ursa.Themes.Semi/Themes/Shared/Pagination.axaml index dd66176..83c83a6 100644 --- a/src/Ursa.Themes.Semi/Themes/Shared/Pagination.axaml +++ b/src/Ursa.Themes.Semi/Themes/Shared/Pagination.axaml @@ -4,4 +4,5 @@ M4.38153 4.39653C4.89024 3.86782 5.71502 3.86782 6.22373 4.39653L12.6185 11.0427C13.1272 11.5714 13.1272 12.4286 12.6185 12.9573L6.22373 19.6035C5.71502 20.1322 4.89024 20.1322 4.38153 19.6035C3.87282 19.0748 3.87282 18.2176 4.38153 17.6888L9.85517 12L4.38153 6.31116C3.87282 5.78245 3.87282 4.92524 4.38153 4.39653Z M11.3815 4.39653C11.8902 3.86782 12.715 3.86782 13.2237 4.39653L19.6185 11.0427C20.1272 11.5714 20.1272 12.4286 19.6185 12.9573L13.2237 19.6035C12.715 20.1322 11.8902 20.1322 11.3815 19.6035C10.8728 19.0748 10.8728 18.2176 11.3815 17.6888L16.8552 12L11.3815 6.31116C10.8728 5.78245 10.8728 4.92524 11.3815 4.39653Z M7.43934 19.7957C6.85355 19.2099 6.85355 18.2601 7.43934 17.6744L13.0962 12.0175L7.43934 6.36065C6.85355 5.77486 6.85355 4.82511 7.43934 4.23933C8.02513 3.65354 8.97487 3.65354 9.56066 4.23933L16.2782 10.9568C16.864 11.5426 16.864 12.4924 16.2782 13.0782L9.56066 19.7957C8.97487 20.3815 8.02513 20.3815 7.43934 19.7957Z M16.2782 4.23933C16.864 4.82511 16.864 5.77486 16.2782 6.36065L10.6213 12.0175L16.2782 17.6744C16.864 18.2601 16.864 19.2099 16.2782 19.7957C15.6924 20.3815 14.7426 20.3815 14.1569 19.7957L7.43934 13.0782C6.85355 12.4924 6.85355 11.5426 7.43934 10.9568L14.1569 4.23933C14.7426 3.65354 15.6924 3.65354 16.2782 4.23933Z + M7 12C7 13.3807 5.88071 14.5 4.5 14.5C3.11929 14.5 2 13.3807 2 12C2 10.6193 3.11929 9.5 4.5 9.5C5.88071 9.5 7 10.6193 7 12Z M14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12Z M19.5 14.5C20.8807 14.5 22 13.3807 22 12C22 10.6193 20.8807 9.5 19.5 9.5C18.1193 9.5 17 10.6193 17 12C17 13.3807 18.1193 14.5 19.5 14.5Z diff --git a/src/Ursa/Controls/Pagination/Pagination.cs b/src/Ursa/Controls/Pagination/Pagination.cs index 0b71333..f462496 100644 --- a/src/Ursa/Controls/Pagination/Pagination.cs +++ b/src/Ursa/Controls/Pagination/Pagination.cs @@ -13,8 +13,8 @@ namespace Ursa.Controls; /// CurrentPage starts from 1. /// Pagination only stores an approximate index internally. /// -[TemplatePart(PART_PreviousButton, typeof(Button))] -[TemplatePart(PART_NextButton, typeof(Button))] +[TemplatePart(PART_PreviousButton, typeof(PaginationButton))] +[TemplatePart(PART_NextButton, typeof(PaginationButton))] [TemplatePart(PART_ButtonPanel, typeof(StackPanel))] [TemplatePart(PART_SizeChangerComboBox, typeof(ComboBox))] public class Pagination: TemplatedControl @@ -23,8 +23,8 @@ public class Pagination: TemplatedControl public const string PART_NextButton = "PART_NextButton"; public const string PART_ButtonPanel = "PART_ButtonPanel"; public const string PART_SizeChangerComboBox = "PART_SizeChangerComboBox"; - private Button? _previousButton; - private Button? _nextButton; + private PaginationButton? _previousButton; + private PaginationButton? _nextButton; private StackPanel? _buttonPanel; private readonly PaginationButton[] _buttons = new PaginationButton[7]; private ComboBox? _sizeChangerComboBox; @@ -34,8 +34,8 @@ public class Pagination: TemplatedControl base.OnApplyTemplate(e); if (_previousButton != null) _previousButton.Click -= OnButtonClick; if (_nextButton != null) _nextButton.Click -= OnButtonClick; - _previousButton = e.NameScope.Find