From 799b498afcfb416fa5d2535bd282c48d19d4b0d9 Mon Sep 17 00:00:00 2001 From: William David Cossey Date: Sat, 25 Aug 2018 16:29:37 +0100 Subject: [PATCH] Cleaning up Themes. Renamed ErrorBrushLight to ErrorLightBrush. ListBoxItem - Removed hardcoded Colors/Brushes, added additional sytling. Removed ListBoxItem Style Selector from AutoCompleteBox (inherrited). CalendarButton - Removed hardcoded Colors/Brushes. DropDownItem - Removed hardcoded Colors/Brushes, added additional sytling. ScrollBar - Removed hardcoded Colors/Brushes. Added ListBox to ControlCatalog. Slider bug fix (hopefully). --- samples/ControlCatalog/ControlCatalog.csproj | 9 +++ samples/ControlCatalog/MainView.xaml | 3 +- samples/ControlCatalog/Pages/ListBoxPage.xaml | 13 ++++ .../ControlCatalog/Pages/ListBoxPage.xaml.cs | 25 ++++++++ .../Pages/NumericUpDownPage.xaml | 4 +- src/Avalonia.Controls/Slider.cs | 8 +-- .../Accents/BaseLight.xaml | 60 +++++++++++++------ .../AutoCompleteBox.xaml | 6 +- .../CalendarButton.xaml | 5 +- .../DataValidationErrors.xaml | 4 +- src/Avalonia.Themes.Default/DropDownItem.xaml | 22 +++++-- src/Avalonia.Themes.Default/ListBoxItem.xaml | 23 ++++++- src/Avalonia.Themes.Default/ScrollBar.xaml | 10 ++-- 13 files changed, 145 insertions(+), 47 deletions(-) create mode 100644 samples/ControlCatalog/Pages/ListBoxPage.xaml create mode 100644 samples/ControlCatalog/Pages/ListBoxPage.xaml.cs diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index dea9b35e24..52f91b1295 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -33,6 +33,15 @@ + + + + MSBuild:Compile + + + MSBuild:Compile + + \ No newline at end of file diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 87cb5e9c5c..ec3bf799b4 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -20,8 +20,9 @@ + - + diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml b/samples/ControlCatalog/Pages/ListBoxPage.xaml new file mode 100644 index 0000000000..3dd8be91c2 --- /dev/null +++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml @@ -0,0 +1,13 @@ + + + ListBox + Hosts a collection of ListBoxItem. + + + + + + diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs b/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs new file mode 100644 index 0000000000..dbe6c74800 --- /dev/null +++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace ControlCatalog.Pages +{ + public class ListBoxPage : UserControl + { + public ListBoxPage() + { + this.InitializeComponent(); + DataContext = Enumerable.Range(1, 10).Select(i => $"Item {i}" ) + .ToArray(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + } +} diff --git a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml index 305bcd177c..2bb6214b58 100644 --- a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml +++ b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml @@ -14,7 +14,7 @@ AllowSpin: - + ClipValueToMinMax: @@ -77,4 +77,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs index 31113812d1..32b0a1f259 100644 --- a/src/Avalonia.Controls/Slider.cs +++ b/src/Avalonia.Controls/Slider.cs @@ -171,11 +171,7 @@ namespace Avalonia.Controls /// Value that want to snap to closest Tick. private void MoveToNextTick(double value) { - double next = SnapToTick(Math.Max(Minimum, Math.Min(Maximum, value))); - if (next != value) - { - Value = next; - } + Value = SnapToTick(Math.Max(Minimum, Math.Min(Maximum, value))); } /// @@ -194,4 +190,4 @@ namespace Avalonia.Controls return value; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml index 4c85e172ff..afac69c9b3 100644 --- a/src/Avalonia.Themes.Default/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Default/Accents/BaseLight.xaml @@ -2,23 +2,49 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib"> - #FFFFFFFF - #FFAAAAAA - #FF888888 - #FF333333 - #FFFFFFFF - #FFAAAAAA - #FF888888 - #FF000000 - #FF808080 + + #CC119EDA + #99119EDA + #66119EDA + #33119EDA + + #FFFFFFFF + #FFAAAAAA + #FF888888 + #FF333333 + #FFFFFFFF + #FFAAAAAA + #FF888888 + #FFF0F0F0 + #FFD0D0D0 + #FF808080 + #FF000000 + #FF808080 + + #FF086F9E + #FFFF0000 + #10FF0000 - #FF086F9E - #CC119EDA - #99119EDA - #66119EDA - #33119EDA - Red - #10ff0000 + + + + + + + + + + + + + + + + + + + + 2 0.5 @@ -27,4 +53,4 @@ 12 16 - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/AutoCompleteBox.xaml b/src/Avalonia.Themes.Default/AutoCompleteBox.xaml index 6a9af487cb..11d8a344d9 100644 --- a/src/Avalonia.Themes.Default/AutoCompleteBox.xaml +++ b/src/Avalonia.Themes.Default/AutoCompleteBox.xaml @@ -36,8 +36,4 @@ - - - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/CalendarButton.xaml b/src/Avalonia.Themes.Default/CalendarButton.xaml index 84969c135f..b70740e0c8 100644 --- a/src/Avalonia.Themes.Default/CalendarButton.xaml +++ b/src/Avalonia.Themes.Default/CalendarButton.xaml @@ -7,6 +7,7 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/DataValidationErrors.xaml b/src/Avalonia.Themes.Default/DataValidationErrors.xaml index f7f28d90d0..be45dfd1b9 100644 --- a/src/Avalonia.Themes.Default/DataValidationErrors.xaml +++ b/src/Avalonia.Themes.Default/DataValidationErrors.xaml @@ -24,7 +24,7 @@ Background="#00FFFFFF"> @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/DropDownItem.xaml b/src/Avalonia.Themes.Default/DropDownItem.xaml index 257030d8af..f52608c0a8 100644 --- a/src/Avalonia.Themes.Default/DropDownItem.xaml +++ b/src/Avalonia.Themes.Default/DropDownItem.xaml @@ -18,10 +18,24 @@ + + + - + + + + - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/ListBoxItem.xaml b/src/Avalonia.Themes.Default/ListBoxItem.xaml index fc2600c1a9..19a6e3d4ec 100644 --- a/src/Avalonia.Themes.Default/ListBoxItem.xaml +++ b/src/Avalonia.Themes.Default/ListBoxItem.xaml @@ -1,6 +1,9 @@ + + + + + + + + - \ No newline at end of file + diff --git a/src/Avalonia.Themes.Default/ScrollBar.xaml b/src/Avalonia.Themes.Default/ScrollBar.xaml index b24c863be9..ef57474eaf 100644 --- a/src/Avalonia.Themes.Default/ScrollBar.xaml +++ b/src/Avalonia.Themes.Default/ScrollBar.xaml @@ -10,7 +10,7 @@ Grid.Column="0"> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> @@ -61,7 +61,7 @@ Grid.Column="0"> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> + Fill="{DynamicResource ThemeForegroundLightBrush}" /> @@ -124,4 +124,4 @@ - \ No newline at end of file +