From b99834ccc61a464290021dee7da6f3b9e4618bb5 Mon Sep 17 00:00:00 2001 From: "Luis v.d.Eltz" Date: Mon, 25 May 2020 14:22:34 +0200 Subject: [PATCH 001/145] Update BoolConverters.cs --- src/Avalonia.Base/Data/Converters/BoolConverters.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Data/Converters/BoolConverters.cs b/src/Avalonia.Base/Data/Converters/BoolConverters.cs index 817d1cea9a..6740c2168f 100644 --- a/src/Avalonia.Base/Data/Converters/BoolConverters.cs +++ b/src/Avalonia.Base/Data/Converters/BoolConverters.cs @@ -3,7 +3,7 @@ using System.Linq; namespace Avalonia.Data.Converters { /// - /// Provides a set of useful s for working with string values. + /// Provides a set of useful s for working with bool values. /// public static class BoolConverters { From 605ede79945df03ff6efb7a50304e5d0dd09381e Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Tue, 26 May 2020 12:07:31 +0200 Subject: [PATCH 002/145] Fix invalid navigation direction for Tab. --- src/Avalonia.Input/NavigationDirection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Input/NavigationDirection.cs b/src/Avalonia.Input/NavigationDirection.cs index 34bedac141..9b9af0b0a6 100644 --- a/src/Avalonia.Input/NavigationDirection.cs +++ b/src/Avalonia.Input/NavigationDirection.cs @@ -102,7 +102,7 @@ namespace Avalonia.Input switch (key) { case Key.Tab: - return (modifiers & KeyModifiers.Shift) != 0 ? + return (modifiers & KeyModifiers.Shift) == 0 ? NavigationDirection.Next : NavigationDirection.Previous; case Key.Up: return NavigationDirection.Up; From 79ff5f48c1a336547a7b7cd84286551f6d90fe6f Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 25 May 2020 14:25:16 +0200 Subject: [PATCH 003/145] Apply global clip to adorner element. Previously, the adorner clip was not taking into account the clip inherited from ancestor controls, resulting in #3984. Fix this by appling the clip from `TransformedBounds.Clip` by translating it to local coordinates first. Note that this doesn't work well for controls with a render transform applied, but at least it fixes the issue in the common case. Fixes #3984 --- src/Avalonia.Controls/Primitives/AdornerLayer.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/AdornerLayer.cs b/src/Avalonia.Controls/Primitives/AdornerLayer.cs index 87ab6cf450..9834bf3d3b 100644 --- a/src/Avalonia.Controls/Primitives/AdornerLayer.cs +++ b/src/Avalonia.Controls/Primitives/AdornerLayer.cs @@ -3,6 +3,7 @@ using System.Collections.Specialized; using System.Linq; using Avalonia.Media; using Avalonia.Rendering; +using Avalonia.Utilities; using Avalonia.VisualTree; namespace Avalonia.Controls.Primitives @@ -78,15 +79,20 @@ namespace Avalonia.Controls.Primitives private void UpdateClip(IControl control, TransformedBounds bounds) { - var clip = control.Clip as RectangleGeometry; - - if (clip == null) + if (!(control.Clip is RectangleGeometry clip)) { - clip = new RectangleGeometry { Transform = new MatrixTransform() }; + clip = new RectangleGeometry(); control.Clip = clip; } - clip.Rect = bounds.Bounds; + var clipBounds = bounds.Bounds; + + if (bounds.Transform.HasInverse) + { + clipBounds = bounds.Clip.TransformToAABB(bounds.Transform.Invert()); + } + + clip.Rect = clipBounds; } private void ChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) From 0d9ea706cb82eac1f5220e67c0e23db34ec9b452 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 26 May 2020 09:43:17 -0300 Subject: [PATCH 004/145] update xamlil to support static resources aliases. --- src/Markup/Avalonia.Markup.Xaml/XamlIl/xamlil.github | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlIl/xamlil.github b/src/Markup/Avalonia.Markup.Xaml/XamlIl/xamlil.github index 4c4b6cf8ff..0681622454 160000 --- a/src/Markup/Avalonia.Markup.Xaml/XamlIl/xamlil.github +++ b/src/Markup/Avalonia.Markup.Xaml/XamlIl/xamlil.github @@ -1 +1 @@ -Subproject commit 4c4b6cf8ff0894c925d87b27d4fc7a064440c218 +Subproject commit 068162245473ec39ee36da12150e928072b96403 From 55200b708081b878f5d9aa2fe24e8b94b6ef8fb8 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 12:44:22 -0300 Subject: [PATCH 005/145] prevent so with ResourceInclude and StyleInclude. --- .../Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs | 4 +++- src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs index 87e2ba3a2e..5f5c0211b8 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs @@ -13,6 +13,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { private Uri? _baseUri; private IResourceDictionary? _loaded; + private bool _isLoading; /// /// Gets the loaded resource dictionary. @@ -21,8 +22,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { get { - if (_loaded == null) + if (!_isLoading) { + _isLoading = true; var loader = new AvaloniaXamlLoader(); _loaded = (IResourceDictionary)loader.Load(Source, _baseUri); } diff --git a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs index 2b39263ee9..6bffaaa804 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs @@ -14,6 +14,7 @@ namespace Avalonia.Markup.Xaml.Styling { private readonly Uri _baseUri; private IStyle[]? _loaded; + private bool _isLoading; /// /// Initializes a new instance of the class. @@ -47,8 +48,10 @@ namespace Avalonia.Markup.Xaml.Styling { get { - if (_loaded == null) + if (!_isLoading) { + _isLoading = true; + var loader = new AvaloniaXamlLoader(); var loaded = (IStyle)loader.Load(Source, _baseUri); _loaded = new[] { loaded }; From 98591e7574b7da56a79b356eebea1b262686f583 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:40:56 -0300 Subject: [PATCH 006/145] remove workaround. --- .../MarkupExtensions/ResourceInclude.cs | 8 +++----- src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs index 5f5c0211b8..2e8fd49702 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs @@ -12,8 +12,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions public class ResourceInclude : IResourceProvider { private Uri? _baseUri; - private IResourceDictionary? _loaded; - private bool _isLoading; + private IResourceDictionary? _loaded; /// /// Gets the loaded resource dictionary. @@ -22,9 +21,8 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { get { - if (!_isLoading) - { - _isLoading = true; + if (_loaded is null) + { var loader = new AvaloniaXamlLoader(); _loaded = (IResourceDictionary)loader.Load(Source, _baseUri); } diff --git a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs index 6bffaaa804..00320ce4e9 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs @@ -13,8 +13,7 @@ namespace Avalonia.Markup.Xaml.Styling public class StyleInclude : IStyle, IResourceProvider { private readonly Uri _baseUri; - private IStyle[]? _loaded; - private bool _isLoading; + private IStyle[]? _loaded; /// /// Initializes a new instance of the class. @@ -48,10 +47,8 @@ namespace Avalonia.Markup.Xaml.Styling { get { - if (!_isLoading) + if (_loaded is null) { - _isLoading = true; - var loader = new AvaloniaXamlLoader(); var loaded = (IStyle)loader.Load(Source, _baseUri); _loaded = new[] { loaded }; From 455c8998766cb6c5806e095b965bcf12d785aaf5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:43:24 -0300 Subject: [PATCH 007/145] Add failing unit tests. --- .../MarkupExtensions/ResourceIncludeTests.cs | 30 +++++++++++++ .../StyleIncludeTests.cs | 44 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs index 7ab6c2de40..e827627938 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs @@ -44,6 +44,36 @@ namespace Avalonia.Markup.Xaml.UnitTests.MakrupExtensions } } + [Fact] + public void Missing_ResourceKey_In_ResourceInclude_Does_Not_Cause_StackOverflow() + { + var styleXaml = @" + + +"; + + using (StartWithResources(("test:style.xaml", styleXaml))) + { + var xaml = @" + + + + + + + + +"; + + var loader = new AvaloniaXamlLoader(); + var app = Application.Current; + + loader.Load(xaml, null, app); + } + } + private IDisposable StartWithResources(params (string, string)[] assets) { var assetLoader = new MockAssetLoader(assets); diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs new file mode 100644 index 0000000000..f4e96942a3 --- /dev/null +++ b/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs @@ -0,0 +1,44 @@ +using System; +using Avalonia.UnitTests; +using Xunit; + +namespace Avalonia.Markup.Xaml.UnitTests +{ + public class StyleIncludeTests : XamlTestBase + { + [Fact] + public void Missing_ResourceKey_In_StyleInclude_Does_Not_Cause_StackOverflow() + { + var styleXaml = @" +"; + + using (StartWithResources(("test:style.xaml", styleXaml))) + { + var xaml = @" + + + + +"; + + var loader = new AvaloniaXamlLoader(); + var app = Application.Current; + + loader.Load(xaml, null, app); + } + } + + private IDisposable StartWithResources(params (string, string)[] assets) + { + var assetLoader = new MockAssetLoader(assets); + var services = new TestServices(assetLoader: assetLoader); + return UnitTestApplication.Start(services); + } + } +} From 8f396d0570165066194b5f13fb3e42e705fa6c4d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:49:33 -0300 Subject: [PATCH 008/145] add fix for StackOverflow in resource loading. --- .../MarkupExtensions/ResourceInclude.cs | 15 ++++++++++++--- .../Avalonia.Markup.Xaml/Styling/StyleInclude.cs | 7 +++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs index 2e8fd49702..ce9e3fd4b1 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs @@ -12,7 +12,8 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions public class ResourceInclude : IResourceProvider { private Uri? _baseUri; - private IResourceDictionary? _loaded; + private IResourceDictionary? _loaded; + private bool _isLoading; /// /// Gets the loaded resource dictionary. @@ -22,9 +23,11 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions get { if (_loaded is null) - { + { + _isLoading = true; var loader = new AvaloniaXamlLoader(); _loaded = (IResourceDictionary)loader.Load(Source, _baseUri); + _isLoading = false; } return _loaded; @@ -48,7 +51,13 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions bool IResourceNode.TryGetResource(object key, out object? value) { - return Loaded.TryGetResource(key, out value); + if(!_isLoading) + { + return Loaded.TryGetResource(key, out value); + } + + value = null; + return false; } void IResourceProvider.AddOwner(IResourceHost owner) => Loaded.AddOwner(owner); diff --git a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs index 00320ce4e9..9d5b56ebb4 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs @@ -13,7 +13,8 @@ namespace Avalonia.Markup.Xaml.Styling public class StyleInclude : IStyle, IResourceProvider { private readonly Uri _baseUri; - private IStyle[]? _loaded; + private IStyle[]? _loaded; + private bool _isLoading; /// /// Initializes a new instance of the class. @@ -49,9 +50,11 @@ namespace Avalonia.Markup.Xaml.Styling { if (_loaded is null) { + _isLoading = true; var loader = new AvaloniaXamlLoader(); var loaded = (IStyle)loader.Load(Source, _baseUri); _loaded = new[] { loaded }; + _isLoading = false; } return _loaded?[0]!; @@ -84,7 +87,7 @@ namespace Avalonia.Markup.Xaml.Styling public bool TryGetResource(object key, out object? value) { - if (Loaded is IResourceProvider p) + if (!_isLoading && Loaded is IResourceProvider p) { return p.TryGetResource(key, out value); } From ed375b578008586617ec5380e9fc5dd03d6f4b79 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:53:49 -0300 Subject: [PATCH 009/145] Allow tests to pass as we expect a KeyNotFound exceptions. --- .../MarkupExtensions/ResourceIncludeTests.cs | 10 +++++++++- .../StyleIncludeTests.cs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs index e827627938..1514d5bd95 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/ResourceIncludeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Avalonia.Controls; using Avalonia.Media; using Avalonia.UnitTests; @@ -70,7 +71,14 @@ namespace Avalonia.Markup.Xaml.UnitTests.MakrupExtensions var loader = new AvaloniaXamlLoader(); var app = Application.Current; - loader.Load(xaml, null, app); + try + { + loader.Load(xaml, null, app); + } + catch (KeyNotFoundException) + { + + } } } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs index f4e96942a3..dca936d229 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/StyleIncludeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Avalonia.UnitTests; using Xunit; @@ -30,7 +31,14 @@ namespace Avalonia.Markup.Xaml.UnitTests var loader = new AvaloniaXamlLoader(); var app = Application.Current; - loader.Load(xaml, null, app); + try + { + loader.Load(xaml, null, app); + } + catch (KeyNotFoundException) + { + + } } } From 46151fd35bd36860f4d2d0176ffea576e3caaf7c Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:55:25 -0300 Subject: [PATCH 010/145] remove unintended change. --- .../Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs | 2 +- src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs index ce9e3fd4b1..1627053e67 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs @@ -22,7 +22,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { get { - if (_loaded is null) + if (_loaded == null) { _isLoading = true; var loader = new AvaloniaXamlLoader(); diff --git a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs index 9d5b56ebb4..ea9042f779 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Styling/StyleInclude.cs @@ -48,7 +48,7 @@ namespace Avalonia.Markup.Xaml.Styling { get { - if (_loaded is null) + if (_loaded == null) { _isLoading = true; var loader = new AvaloniaXamlLoader(); From ab6ff87a73b9d707176de8f15d5cd81cf2f5a70c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 28 May 2020 12:16:09 +0200 Subject: [PATCH 011/145] Fix spacing. --- .../Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs index 1627053e67..0cedf4f364 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/ResourceInclude.cs @@ -51,7 +51,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions bool IResourceNode.TryGetResource(object key, out object? value) { - if(!_isLoading) + if (!_isLoading) { return Loaded.TryGetResource(key, out value); } From ff7e724f73e8220550930f5b5d1bff52bba45934 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 28 May 2020 12:59:20 +0200 Subject: [PATCH 012/145] Make ItemsRepeater.GetOrCreateElement public As it's public in the WinUI version: https://docs.microsoft.com/en-us/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.getorcreateelement?view=winui-2.4 --- src/Avalonia.Controls/Repeater/ItemsRepeater.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs index 069da6e9ac..2c870b4efd 100644 --- a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs +++ b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs @@ -219,12 +219,21 @@ namespace Avalonia.Controls /// public IControl TryGetElement(int index) => GetElementFromIndexImpl(index); + /// + /// Retrieves the UIElement that corresponds to the item at the specified index in the + /// data source. + /// + /// The index of the item. + /// + /// An that corresponds to the item at the specified index. If the + /// item is not realized, a new UIElement is created. + /// + public IControl GetOrCreateElement(int index) => GetOrCreateElementImpl(index); + internal void PinElement(IControl element) => _viewManager.UpdatePin(element, true); internal void UnpinElement(IControl element) => _viewManager.UpdatePin(element, false); - internal IControl GetOrCreateElement(int index) => GetOrCreateElementImpl(index); - internal static VirtualizationInfo TryGetVirtualizationInfo(IControl element) { var value = element.GetValue(VirtualizationInfoProperty); From f46c62801ef473af174640d99537c9fc02f84681 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 28 May 2020 15:04:46 +0200 Subject: [PATCH 013/145] Convert Color resources to brushes. Make `StaticResource` and `DynamicResource` automatically convert `Color`s to `ImmutableSolidColorBrush`es and add a `ColorToBrushConverter` for use by bindings. To do this I made `GetResourceObservable` accept an optional conversion function. --- .../Controls/ResourceNodeExtensions.cs | 35 +++++--- .../Avalonia.Markup.Xaml.csproj | 1 + .../Converters/ColorToBrushConverter.cs | 88 +++++++++++++++++++ .../DynamicResourceExtension.cs | 18 +++- .../StaticResourceExtension.cs | 23 +++-- .../DynamicResourceExtensionTests.cs | 21 +++++ .../StaticResourceExtensionTests.cs | 21 +++++ 7 files changed, 186 insertions(+), 21 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml/Converters/ColorToBrushConverter.cs diff --git a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs index 7771629e0d..250274c39b 100644 --- a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs +++ b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs @@ -1,4 +1,5 @@ using System; +using Avalonia.Data.Converters; using Avalonia.LogicalTree; using Avalonia.Reactive; @@ -58,31 +59,39 @@ namespace Avalonia.Controls return false; } - public static IObservable GetResourceObservable(this IStyledElement control, object key) + public static IObservable GetResourceObservable( + this IStyledElement control, + object key, + Func? converter = null) { control = control ?? throw new ArgumentNullException(nameof(control)); key = key ?? throw new ArgumentNullException(nameof(key)); - return new ResourceObservable(control, key); + return new ResourceObservable(control, key, converter); } - public static IObservable GetResourceObservable(this IResourceProvider resourceProvider, object key) + public static IObservable GetResourceObservable( + this IResourceProvider resourceProvider, + object key, + Func? converter = null) { resourceProvider = resourceProvider ?? throw new ArgumentNullException(nameof(resourceProvider)); key = key ?? throw new ArgumentNullException(nameof(key)); - return new FloatingResourceObservable(resourceProvider, key); + return new FloatingResourceObservable(resourceProvider, key, converter); } private class ResourceObservable : LightweightObservableBase { private readonly IStyledElement _target; private readonly object _key; + private readonly Func? _converter; - public ResourceObservable(IStyledElement target, object key) + public ResourceObservable(IStyledElement target, object key, Func? converter) { _target = target; _key = key; + _converter = converter; } protected override void Initialize() @@ -97,25 +106,29 @@ namespace Avalonia.Controls protected override void Subscribed(IObserver observer, bool first) { - observer.OnNext(_target.FindResource(_key)); + observer.OnNext(Convert(_target.FindResource(_key))); } private void ResourcesChanged(object sender, ResourcesChangedEventArgs e) { - PublishNext(_target.FindResource(_key)); + PublishNext(Convert(_target.FindResource(_key))); } + + private object? Convert(object? value) => _converter?.Invoke(value) ?? value; } private class FloatingResourceObservable : LightweightObservableBase { private readonly IResourceProvider _target; private readonly object _key; + private readonly Func? _converter; private IResourceHost? _owner; - public FloatingResourceObservable(IResourceProvider target, object key) + public FloatingResourceObservable(IResourceProvider target, object key, Func? converter) { _target = target; _key = key; + _converter = converter; } protected override void Initialize() @@ -134,13 +147,13 @@ namespace Avalonia.Controls { if (_target.Owner is object) { - observer.OnNext(_target.Owner?.FindResource(_key)); + observer.OnNext(Convert(_target.Owner?.FindResource(_key))); } } private void PublishNext() { - PublishNext(_target.Owner?.FindResource(_key)); + PublishNext(Convert(_target.Owner?.FindResource(_key))); } private void OwnerChanged(object sender, EventArgs e) @@ -164,6 +177,8 @@ namespace Avalonia.Controls { PublishNext(); } + + private object? Convert(object? value) => _converter?.Invoke(value) ?? value; } } } diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj index 06c5375520..985a6b9f5a 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj +++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Markup/Avalonia.Markup.Xaml/Converters/ColorToBrushConverter.cs b/src/Markup/Avalonia.Markup.Xaml/Converters/ColorToBrushConverter.cs new file mode 100644 index 0000000000..5b44e9eb50 --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml/Converters/ColorToBrushConverter.cs @@ -0,0 +1,88 @@ +using System; +using System.Globalization; +using Avalonia.Data.Converters; +using Avalonia.Media; +using Avalonia.Media.Immutable; + +namespace Avalonia.Markup.Xaml.Converters +{ + /// + /// Converts a to an . + /// + public class ColorToBrushConverter : IValueConverter + { + /// + /// Converts a to an if the arguments are of the + /// correct type. + /// + /// The value. + /// The target type. + /// Not used. + /// Not used. + /// + /// If is a and + /// is then converts the color to a solid color brush. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return Convert(value, targetType); + } + + /// + /// Converts an to a if the arguments are of the + /// correct type. + /// + /// The value. + /// The target type. + /// Not used. + /// Not used. + /// + /// If is an and + /// is then converts the solid color brush to a color. + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return ConvertBack(value, targetType); + } + + /// + /// Converts a to an if the arguments are of the + /// correct type. + /// + /// The value. + /// The target type. + /// + /// If is a and + /// is then converts the color to a solid color brush. + /// + public static object Convert(object value, Type targetType) + { + if (targetType == typeof(IBrush) && value is Color c) + { + return new ImmutableSolidColorBrush(c); + } + + return value; + } + + /// + /// Converts an to a if the arguments are of the + /// correct type. + /// + /// The value. + /// The target type. + /// + /// If is an and + /// is then converts the solid color brush to a color. + /// + public static object ConvertBack(object value, Type targetType) + { + if (targetType == typeof(Color) && value is ISolidColorBrush brush) + { + return brush.Color; + } + + return value; + } + } +} diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs index d0d4aae9b8..03fd2e60dd 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs @@ -1,6 +1,8 @@ using System; using Avalonia.Controls; using Avalonia.Data; +using Avalonia.Markup.Xaml.Converters; +using Avalonia.Media; #nullable enable @@ -54,11 +56,23 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions if (control != null) { - return InstancedBinding.OneWay(control.GetResourceObservable(ResourceKey)); + var source = control.GetResourceObservable(ResourceKey, GetConverter(targetProperty)); + return InstancedBinding.OneWay(source); } else if (_resourceProvider is object) { - return InstancedBinding.OneWay(_resourceProvider.GetResourceObservable(ResourceKey)); + var source = _resourceProvider.GetResourceObservable(ResourceKey, GetConverter(targetProperty)); + return InstancedBinding.OneWay(source); + } + + return null; + } + + private Func? GetConverter(AvaloniaProperty targetProperty) + { + if (targetProperty?.PropertyType == typeof(IBrush)) + { + return x => ColorToBrushConverter.Convert(x, typeof(IBrush)); } return null; diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs index 6d9fac638c..4ad68fc63e 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/StaticResourceExtension.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Reflection; using Avalonia.Controls; using Avalonia.Markup.Data; +using Avalonia.Markup.Xaml.Converters; using Avalonia.Markup.Xaml.XamlIl.Runtime; namespace Avalonia.Markup.Xaml.MarkupExtensions @@ -24,6 +24,14 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions public object ProvideValue(IServiceProvider serviceProvider) { var stack = serviceProvider.GetService(); + var provideTarget = serviceProvider.GetService(); + + var targetType = provideTarget.TargetProperty switch + { + AvaloniaProperty ap => ap.PropertyType, + PropertyInfo pi => pi.PropertyType, + _ => null, + }; // Look upwards though the ambient context for IResourceHosts and IResourceProviders // which might be able to give us the resource. @@ -33,30 +41,27 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions if (e is IResourceHost host && host.TryGetResource(ResourceKey, out value)) { - return value; + return ColorToBrushConverter.Convert(value, targetType); } else if (e is IResourceProvider provider && provider.TryGetResource(ResourceKey, out value)) { - return value; + return ColorToBrushConverter.Convert(value, targetType); } } - // The resource still hasn't been found, so add a delayed one-time binding. - var provideTarget = serviceProvider.GetService(); - if (provideTarget.TargetObject is IControl target && provideTarget.TargetProperty is PropertyInfo property) { - DelayedBinding.Add(target, property, GetValue); + DelayedBinding.Add(target, property, x => GetValue(x, targetType)); return AvaloniaProperty.UnsetValue; } throw new KeyNotFoundException($"Static resource '{ResourceKey}' not found."); } - private object GetValue(IStyledElement control) + private object GetValue(IStyledElement control, Type targetType) { - return control.FindResource(ResourceKey); + return ColorToBrushConverter.Convert(control.FindResource(ResourceKey), targetType); } } } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs index ed3e4c986b..e651c5f29c 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs @@ -797,6 +797,27 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void Automatically_Converts_Color_To_SolidColorBrush() + { + var xaml = @" + + + #ff506070 + + + +"; + + var loader = new AvaloniaXamlLoader(); + var userControl = (UserControl)loader.Load(xaml); + var border = userControl.FindControl("border"); + + var brush = (ISolidColorBrush)border.Background; + Assert.Equal(0xff506070, brush.Color.ToUint32()); + } + private IDisposable StyledWindow(params (string, string)[] assets) { var services = TestServices.StyledWindow.With( diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/StaticResourceExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/StaticResourceExtensionTests.cs index ddfa96c094..efcda47f0f 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/StaticResourceExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/StaticResourceExtensionTests.cs @@ -511,6 +511,27 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Equal(0xff506070, brush.Color.ToUint32()); } + [Fact] + public void Automatically_Converts_Color_To_SolidColorBrush() + { + var xaml = @" + + + #ff506070 + + + +"; + + var loader = new AvaloniaXamlLoader(); + var userControl = (UserControl)loader.Load(xaml); + var border = userControl.FindControl("border"); + + var brush = (ISolidColorBrush)border.Background; + Assert.Equal(0xff506070, brush.Color.ToUint32()); + } + private IDisposable StyledWindow(params (string, string)[] assets) { var services = TestServices.StyledWindow.With( From f8a95fa2a124b977d957071e0fb0ad84952cfd8d Mon Sep 17 00:00:00 2001 From: aguahombre Date: Thu, 28 May 2020 15:29:56 +0100 Subject: [PATCH 014/145] Fix tooltip memory leak --- src/Avalonia.Controls/ToolTip.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/ToolTip.cs b/src/Avalonia.Controls/ToolTip.cs index 3e57ba529f..2f11746891 100644 --- a/src/Avalonia.Controls/ToolTip.cs +++ b/src/Avalonia.Controls/ToolTip.cs @@ -246,7 +246,7 @@ namespace Avalonia.Controls if (_popup != null) { _popup.SetChild(null); - _popup.Hide(); + _popup.Dispose(); _popup = null; } } From 59172a3f7906c2e970a3fb3662d6cfadb7e8059f Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Thu, 28 May 2020 14:26:52 -0300 Subject: [PATCH 015/145] Add a Fluent theme (identical to Default for now) to allow new theme work to progress without affecting default theme and templates (#4004) * Define the base colours and brushes. * import base / system colours. * test textbox using alias for resource. * add a fluent theme * revert default theme * revert original theme. * restore default theme. * remove old accents from fluent theme. * rename namespaces, etc for new theme. * make control catalog run again. * undo textbox work. * Revert "undo textbox work." This reverts commit 477665c306cad1c82fc655e7f22cf90e1855a015. * add missing fontweight. * add the UWP base resources. * Organise the Fluent themes to separate UWP base resources from Fluent resources. * Add fluentBase dark and light overrides. * Add xaml files to contain control resources until we get equivalent of ThemeDictionaries. * undo textbox work. --- Avalonia.sln | 26 ++ build/CoreLibraries.props | 1 + samples/ControlCatalog/App.xaml | 6 +- src/Avalonia.Themes.Fluent/Accents/Base.xaml | 18 + .../Accents/BaseDark.xaml | 350 ++++++++++++++++++ .../Accents/BaseLight.xaml | 349 +++++++++++++++++ .../Accents/FluentBaseDark.xaml | 74 ++++ .../Accents/FluentBaseLight.xaml | 75 ++++ .../Accents/FluentControlResourcesDark.xaml | 7 + .../Accents/FluentControlResourcesLight.xaml | 7 + .../Accents/FluentDark.xaml | 8 + .../Accents/FluentLight.xaml | 8 + .../AutoCompleteBox.xaml | 38 ++ .../Avalonia.Themes.Fluent.csproj | 22 ++ src/Avalonia.Themes.Fluent/Button.xaml | 34 ++ src/Avalonia.Themes.Fluent/ButtonSpinner.xaml | 104 ++++++ src/Avalonia.Themes.Fluent/Calendar.xaml | 31 ++ .../CalendarButton.xaml | 81 ++++ .../CalendarDayButton.xaml | 116 ++++++ src/Avalonia.Themes.Fluent/CalendarItem.xaml | 183 +++++++++ src/Avalonia.Themes.Fluent/Carousel.xaml | 16 + src/Avalonia.Themes.Fluent/CheckBox.xaml | 69 ++++ src/Avalonia.Themes.Fluent/ComboBox.xaml | 64 ++++ src/Avalonia.Themes.Fluent/ComboBoxItem.xaml | 41 ++ .../ContentControl.xaml | 15 + src/Avalonia.Themes.Fluent/ContextMenu.xaml | 23 ++ .../DataValidationErrors.xaml | 38 ++ src/Avalonia.Themes.Fluent/DatePicker.xaml | 126 +++++++ .../EmbeddableControlRoot.xaml | 19 + src/Avalonia.Themes.Fluent/Expander.xaml | 138 +++++++ src/Avalonia.Themes.Fluent/FluentTheme.xaml | 55 +++ .../FluentTheme.xaml.cs | 12 + src/Avalonia.Themes.Fluent/FocusAdorner.xaml | 10 + src/Avalonia.Themes.Fluent/GridSplitter.xaml | 23 ++ .../InverseBooleanValueConverter.cs | 20 + src/Avalonia.Themes.Fluent/ItemsControl.xaml | 15 + src/Avalonia.Themes.Fluent/ListBox.xaml | 31 ++ src/Avalonia.Themes.Fluent/ListBoxItem.xaml | 41 ++ src/Avalonia.Themes.Fluent/Menu.xaml | 16 + src/Avalonia.Themes.Fluent/MenuItem.xaml | 147 ++++++++ src/Avalonia.Themes.Fluent/NativeMenuBar.xaml | 26 ++ .../NotificationCard.xaml | 92 +++++ src/Avalonia.Themes.Fluent/NumericUpDown.xaml | 38 ++ .../OverlayPopupHost.xaml | 17 + src/Avalonia.Themes.Fluent/PopupRoot.xaml | 17 + src/Avalonia.Themes.Fluent/ProgressBar.xaml | 81 ++++ src/Avalonia.Themes.Fluent/RadioButton.xaml | 60 +++ src/Avalonia.Themes.Fluent/RepeatButton.xaml | 40 ++ src/Avalonia.Themes.Fluent/ScrollBar.xaml | 142 +++++++ src/Avalonia.Themes.Fluent/ScrollViewer.xaml | 47 +++ src/Avalonia.Themes.Fluent/Separator.xaml | 20 + src/Avalonia.Themes.Fluent/Slider.xaml | 93 +++++ src/Avalonia.Themes.Fluent/TabControl.xaml | 62 ++++ src/Avalonia.Themes.Fluent/TabItem.xaml | 45 +++ src/Avalonia.Themes.Fluent/TabStrip.xaml | 20 + src/Avalonia.Themes.Fluent/TabStripItem.xaml | 23 ++ src/Avalonia.Themes.Fluent/TextBox.xaml | 78 ++++ src/Avalonia.Themes.Fluent/ToggleButton.xaml | 38 ++ src/Avalonia.Themes.Fluent/ToolTip.xaml | 17 + src/Avalonia.Themes.Fluent/TreeView.xaml | 23 ++ src/Avalonia.Themes.Fluent/TreeViewItem.xaml | 92 +++++ src/Avalonia.Themes.Fluent/UserControl.xaml | 15 + src/Avalonia.Themes.Fluent/Window.xaml | 22 ++ .../WindowNotificationManager.xaml | 45 +++ src/Avalonia.Visuals/Media/FontWeight.cs | 5 + 65 files changed, 3612 insertions(+), 3 deletions(-) create mode 100644 src/Avalonia.Themes.Fluent/Accents/Base.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml create mode 100644 src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml create mode 100644 src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml create mode 100644 src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj create mode 100644 src/Avalonia.Themes.Fluent/Button.xaml create mode 100644 src/Avalonia.Themes.Fluent/ButtonSpinner.xaml create mode 100644 src/Avalonia.Themes.Fluent/Calendar.xaml create mode 100644 src/Avalonia.Themes.Fluent/CalendarButton.xaml create mode 100644 src/Avalonia.Themes.Fluent/CalendarDayButton.xaml create mode 100644 src/Avalonia.Themes.Fluent/CalendarItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/Carousel.xaml create mode 100644 src/Avalonia.Themes.Fluent/CheckBox.xaml create mode 100644 src/Avalonia.Themes.Fluent/ComboBox.xaml create mode 100644 src/Avalonia.Themes.Fluent/ComboBoxItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/ContentControl.xaml create mode 100644 src/Avalonia.Themes.Fluent/ContextMenu.xaml create mode 100644 src/Avalonia.Themes.Fluent/DataValidationErrors.xaml create mode 100644 src/Avalonia.Themes.Fluent/DatePicker.xaml create mode 100644 src/Avalonia.Themes.Fluent/EmbeddableControlRoot.xaml create mode 100644 src/Avalonia.Themes.Fluent/Expander.xaml create mode 100644 src/Avalonia.Themes.Fluent/FluentTheme.xaml create mode 100644 src/Avalonia.Themes.Fluent/FluentTheme.xaml.cs create mode 100644 src/Avalonia.Themes.Fluent/FocusAdorner.xaml create mode 100644 src/Avalonia.Themes.Fluent/GridSplitter.xaml create mode 100644 src/Avalonia.Themes.Fluent/InverseBooleanValueConverter.cs create mode 100644 src/Avalonia.Themes.Fluent/ItemsControl.xaml create mode 100644 src/Avalonia.Themes.Fluent/ListBox.xaml create mode 100644 src/Avalonia.Themes.Fluent/ListBoxItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/Menu.xaml create mode 100644 src/Avalonia.Themes.Fluent/MenuItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/NativeMenuBar.xaml create mode 100644 src/Avalonia.Themes.Fluent/NotificationCard.xaml create mode 100644 src/Avalonia.Themes.Fluent/NumericUpDown.xaml create mode 100644 src/Avalonia.Themes.Fluent/OverlayPopupHost.xaml create mode 100644 src/Avalonia.Themes.Fluent/PopupRoot.xaml create mode 100644 src/Avalonia.Themes.Fluent/ProgressBar.xaml create mode 100644 src/Avalonia.Themes.Fluent/RadioButton.xaml create mode 100644 src/Avalonia.Themes.Fluent/RepeatButton.xaml create mode 100644 src/Avalonia.Themes.Fluent/ScrollBar.xaml create mode 100644 src/Avalonia.Themes.Fluent/ScrollViewer.xaml create mode 100644 src/Avalonia.Themes.Fluent/Separator.xaml create mode 100644 src/Avalonia.Themes.Fluent/Slider.xaml create mode 100644 src/Avalonia.Themes.Fluent/TabControl.xaml create mode 100644 src/Avalonia.Themes.Fluent/TabItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/TabStrip.xaml create mode 100644 src/Avalonia.Themes.Fluent/TabStripItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/TextBox.xaml create mode 100644 src/Avalonia.Themes.Fluent/ToggleButton.xaml create mode 100644 src/Avalonia.Themes.Fluent/ToolTip.xaml create mode 100644 src/Avalonia.Themes.Fluent/TreeView.xaml create mode 100644 src/Avalonia.Themes.Fluent/TreeViewItem.xaml create mode 100644 src/Avalonia.Themes.Fluent/UserControl.xaml create mode 100644 src/Avalonia.Themes.Fluent/Window.xaml create mode 100644 src/Avalonia.Themes.Fluent/WindowNotificationManager.xaml diff --git a/Avalonia.sln b/Avalonia.sln index 38f8e5f720..e8d5034fb0 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -206,6 +206,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.FreeDesktop", "src EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.DataGrid.UnitTests", "tests\Avalonia.Controls.DataGrid.UnitTests\Avalonia.Controls.DataGrid.UnitTests.csproj", "{351337F5-D66F-461B-A957-4EF60BDB4BA6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Themes.Fluent", "src\Avalonia.Themes.Fluent\Avalonia.Themes.Fluent.csproj", "{C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13 @@ -1921,6 +1923,30 @@ Global {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhone.Build.0 = Release|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhone.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhone.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|Any CPU.Build.0 = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhone.ActiveCfg = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhone.Build.0 = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props index d61268173d..2b54ee3f56 100644 --- a/build/CoreLibraries.props +++ b/build/CoreLibraries.props @@ -11,6 +11,7 @@ + diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml index e40509dfda..c9441782a2 100644 --- a/samples/ControlCatalog/App.xaml +++ b/samples/ControlCatalog/App.xaml @@ -1,9 +1,9 @@ - - - + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml new file mode 100644 index 0000000000..2b13fb0d3b --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -0,0 +1,350 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml new file mode 100644 index 0000000000..3db9915334 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -0,0 +1,349 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml new file mode 100644 index 0000000000..9623204e2c --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -0,0 +1,74 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml new file mode 100644 index 0000000000..2d8e457457 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -0,0 +1,75 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml new file mode 100644 index 0000000000..70599aa51e --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -0,0 +1,7 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml new file mode 100644 index 0000000000..70599aa51e --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -0,0 +1,7 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml new file mode 100644 index 0000000000..80ad15ee15 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml new file mode 100644 index 0000000000..38601a2f2d --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml b/src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml new file mode 100644 index 0000000000..788b60892b --- /dev/null +++ b/src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml @@ -0,0 +1,38 @@ + + + diff --git a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj new file mode 100644 index 0000000000..3c3e14010d --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj @@ -0,0 +1,22 @@ + + + netstandard2.0 + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Button.xaml b/src/Avalonia.Themes.Fluent/Button.xaml new file mode 100644 index 0000000000..698ddec2a8 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Button.xaml @@ -0,0 +1,34 @@ + + + + + + \ No newline at end of file diff --git a/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml b/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml new file mode 100644 index 0000000000..89fbb9d64d --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml @@ -0,0 +1,104 @@ + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Calendar.xaml b/src/Avalonia.Themes.Fluent/Calendar.xaml new file mode 100644 index 0000000000..6bbee4ef17 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Calendar.xaml @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/src/Avalonia.Themes.Fluent/CalendarButton.xaml b/src/Avalonia.Themes.Fluent/CalendarButton.xaml new file mode 100644 index 0000000000..3314534b3b --- /dev/null +++ b/src/Avalonia.Themes.Fluent/CalendarButton.xaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml b/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml new file mode 100644 index 0000000000..2d79e62a75 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/CalendarItem.xaml b/src/Avalonia.Themes.Fluent/CalendarItem.xaml new file mode 100644 index 0000000000..dfd89ed82f --- /dev/null +++ b/src/Avalonia.Themes.Fluent/CalendarItem.xaml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Carousel.xaml b/src/Avalonia.Themes.Fluent/Carousel.xaml new file mode 100644 index 0000000000..955a49a974 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Carousel.xaml @@ -0,0 +1,16 @@ + diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml new file mode 100644 index 0000000000..f87ae2674f --- /dev/null +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -0,0 +1,69 @@ + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/ComboBox.xaml new file mode 100644 index 0000000000..95bd9550a5 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ComboBox.xaml @@ -0,0 +1,64 @@ + + + + + diff --git a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml new file mode 100644 index 0000000000..23456ec744 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/ContentControl.xaml b/src/Avalonia.Themes.Fluent/ContentControl.xaml new file mode 100644 index 0000000000..d76eecee84 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ContentControl.xaml @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/src/Avalonia.Themes.Fluent/ContextMenu.xaml b/src/Avalonia.Themes.Fluent/ContextMenu.xaml new file mode 100644 index 0000000000..75f8f7c23d --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ContextMenu.xaml @@ -0,0 +1,23 @@ + diff --git a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml new file mode 100644 index 0000000000..f4145a51f5 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/DatePicker.xaml b/src/Avalonia.Themes.Fluent/DatePicker.xaml new file mode 100644 index 0000000000..7adb1c2d5f --- /dev/null +++ b/src/Avalonia.Themes.Fluent/DatePicker.xaml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + Light = 300, + /// + /// Specifies a "semi light" font weight. + /// + SemiLight = 350, + /// /// Specifies a "normal" font weight. /// From f68d81941401cef9c1a7bd1184093a18e4a024c9 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 18:10:22 -0300 Subject: [PATCH 016/145] Add TextBox control resources. --- .../Accents/FluentControlResourcesDark.xaml | 25 ++++++++++++++++++- .../Accents/FluentControlResourcesLight.xaml | 25 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 70599aa51e..38e4778e24 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -2,6 +2,29 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 70599aa51e..276828c587 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -2,6 +2,29 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - + + + + + + + + + + + + + + + + + + + + + + + + From a596e0bfb8867c49b37e6bf3b5be3993db9f8e98 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 19:40:16 -0300 Subject: [PATCH 017/145] Almost Working fluent textbox. --- samples/ControlCatalog/App.xaml | 3 +- samples/ControlCatalog/MainView.xaml.cs | 44 +++++------ samples/ControlCatalog/MainWindow.xaml | 2 +- src/Avalonia.Themes.Fluent/Accents/Base.xaml | 6 ++ .../Accents/FluentBaseDark.xaml | 32 ++++++++ src/Avalonia.Themes.Fluent/TextBox.xaml | 73 ++++++++++++++++--- 6 files changed, 124 insertions(+), 36 deletions(-) diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml index c9441782a2..d59c15bb6a 100644 --- a/samples/ControlCatalog/App.xaml +++ b/samples/ControlCatalog/App.xaml @@ -1,7 +1,8 @@ - + + diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs index 8c4818fb07..fceca426f4 100644 --- a/samples/ControlCatalog/MainView.xaml.cs +++ b/samples/ControlCatalog/MainView.xaml.cs @@ -32,30 +32,30 @@ namespace ControlCatalog } - var light = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) - { - Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default") - }; - var dark = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) - { - Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default") - }; + //var light = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) + //{ + // Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default") + //}; + //var dark = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) + //{ + // Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default") + //}; - var themes = this.Find("Themes"); - themes.SelectionChanged += (sender, e) => - { - switch (themes.SelectedIndex) - { - case 0: - Styles[0] = light; - break; - case 1: - Styles[0] = dark; - break; - } - }; - Styles.Add(light); + //var themes = this.Find("Themes"); + //themes.SelectionChanged += (sender, e) => + //{ + // switch (themes.SelectedIndex) + // { + // case 0: + // Styles[0] = light; + // break; + // case 1: + // Styles[0] = dark; + // break; + // } + //}; + //Styles.Add(light); var decorations = this.Find("Decorations"); decorations.SelectionChanged += (sender, e) => diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml index a0bb956425..670e30725b 100644 --- a/samples/ControlCatalog/MainWindow.xaml +++ b/samples/ControlCatalog/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:ControlCatalog.ViewModels" xmlns:v="clr-namespace:ControlCatalog.Views" - x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}" Background="Transparent"> + x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}"> diff --git a/src/Avalonia.Themes.Fluent/Accents/Base.xaml b/src/Avalonia.Themes.Fluent/Accents/Base.xaml index b94c0ecf5f..6dc59bed21 100644 --- a/src/Avalonia.Themes.Fluent/Accents/Base.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/Base.xaml @@ -14,5 +14,11 @@ #FF000000 Segoe UI 14 + + + True + 1 + 2 + 10,6,6,5 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index 9623204e2c..d2a8cac601 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -70,5 +70,37 @@ #FF00459D #FF000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/TextBox.xaml b/src/Avalonia.Themes.Fluent/TextBox.xaml index 4fb3653e89..4e4cdf5231 100644 --- a/src/Avalonia.Themes.Fluent/TextBox.xaml +++ b/src/Avalonia.Themes.Fluent/TextBox.xaml @@ -1,17 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + - + From 55995c258b8cf1ff91242ba4a29cf1240e41e004 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 19:48:51 -0300 Subject: [PATCH 018/145] fix fluent textbox background. --- src/Avalonia.Themes.Fluent/TextBox.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/TextBox.xaml b/src/Avalonia.Themes.Fluent/TextBox.xaml index 4e4cdf5231..fc88212fde 100644 --- a/src/Avalonia.Themes.Fluent/TextBox.xaml +++ b/src/Avalonia.Themes.Fluent/TextBox.xaml @@ -2,6 +2,7 @@ From df06ad1b11e4d72bad3d8f34b927ad209fb50540 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 20:45:41 -0300 Subject: [PATCH 020/145] add missing light resources for textbox. --- .../Accents/FluentBaseLight.xaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index 2d8e457457..a77fbd80fe 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -71,5 +71,37 @@ #FFFFFFFF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fb0cced162fcc7a4e26971caa1df04642752afa4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 22:27:08 -0300 Subject: [PATCH 021/145] Fix Textbox layout. --- src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml | 4 ++-- src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml | 2 +- src/Avalonia.Themes.Fluent/TextBox.xaml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml index 80ad15ee15..5b6da70233 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml @@ -1,8 +1,8 @@ - + xmlns:sys="clr-namespace:System;assembly=netstandard"> + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml index 38601a2f2d..5825a2bf34 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml @@ -1,8 +1,8 @@ - + diff --git a/src/Avalonia.Themes.Fluent/TextBox.xaml b/src/Avalonia.Themes.Fluent/TextBox.xaml index 1b766376b5..e89cf2b49c 100644 --- a/src/Avalonia.Themes.Fluent/TextBox.xaml +++ b/src/Avalonia.Themes.Fluent/TextBox.xaml @@ -46,9 +46,7 @@ + Margin="{TemplateBinding BorderThickness}"> - + Date: Thu, 28 May 2020 14:38:10 -0300 Subject: [PATCH 022/145] keep control catalog on old theme for now. --- samples/ControlCatalog/App.xaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml index d59c15bb6a..20ca291910 100644 --- a/samples/ControlCatalog/App.xaml +++ b/samples/ControlCatalog/App.xaml @@ -2,10 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ControlCatalog.App"> - - - - + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index a77fbd80fe..5ef54abeaf 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -103,5 +103,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a8d598d9c87b721ee9d3ddad53b4f1f7d686164f Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 23:19:20 -0300 Subject: [PATCH 025/145] add fluent resources for checkbox. --- .../Accents/FluentControlResourcesDark.xaml | 90 +++++++++++++++++++ .../Accents/FluentControlResourcesLight.xaml | 90 +++++++++++++++++++ 2 files changed, 180 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 38e4778e24..edfc487647 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -26,5 +26,95 @@ + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 276828c587..70bee7074e 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -26,5 +26,95 @@ + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 91caa451320c63eaab9fd800153e3c8dfbcbc015 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 27 May 2020 23:53:35 -0300 Subject: [PATCH 026/145] add initial port of checkbox template. --- src/Avalonia.Themes.Fluent/CheckBox.xaml | 89 ++++++++++++------------ 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml index f87ae2674f..1e6300c3fb 100644 --- a/src/Avalonia.Themes.Fluent/CheckBox.xaml +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -1,50 +1,53 @@ From 50fe90f8b5f0ef55184714a1a320bb24ed42364e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 01:15:12 -0300 Subject: [PATCH 027/145] almost fully working checkbox. --- .../Accents/BaseDark.xaml | 4 +- .../Accents/BaseLight.xaml | 4 +- .../Accents/FluentControlResourcesDark.xaml | 4 +- src/Avalonia.Themes.Fluent/CheckBox.xaml | 99 ++++++++++++++++++- 4 files changed, 101 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml index 2b13fb0d3b..7ee211f249 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -161,8 +161,8 @@ 3 374 0 - 2 - 0 + 2 + 0 21 64 80 diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml index 3db9915334..309759705c 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -160,8 +160,8 @@ 3 374 0 - 2 - 0 + 2 + 0 21 64 80 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index edfc487647..56c6de1144 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -28,8 +28,8 @@ - 1 - 0 + 1 + 0 diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml index 1e6300c3fb..beadc28d13 100644 --- a/src/Avalonia.Themes.Fluent/CheckBox.xaml +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -1,4 +1,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 7411c3ae7b48f0bde6cd00daa47f73b4c63982b1 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 01:46:57 -0300 Subject: [PATCH 028/145] further progress on checkbox. --- src/Avalonia.Themes.Fluent/CheckBox.xaml | 43 +++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml index beadc28d13..7f93c2842d 100644 --- a/src/Avalonia.Themes.Fluent/CheckBox.xaml +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -35,15 +35,8 @@ CornerRadius="{DynamicResource ControlCornerRadius}" /> - + - + + + + + + + @@ -109,6 +119,23 @@ + + + + + + + From b3040728fe0aa93809babad3dc7cad4d963d9bce Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 12:22:43 -0300 Subject: [PATCH 029/145] add missing state styles. --- src/Avalonia.Themes.Fluent/CheckBox.xaml | 192 +++++++++++++++++------ 1 file changed, 146 insertions(+), 46 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml index 7f93c2842d..fa6b044cf6 100644 --- a/src/Avalonia.Themes.Fluent/CheckBox.xaml +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -21,34 +21,34 @@ --> - - - - - - - - - - - - + + + + + + + + + + - + + + @@ -84,8 +84,8 @@ + + + + + + + + + + + + + + @@ -108,7 +142,7 @@ @@ -129,8 +163,8 @@ + + + + + + + + + + + + + + + - + - + + + - - - - - - + + + + From fb3900aea3758b5fda19ba65488e432a285aef4e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 13:22:54 -0300 Subject: [PATCH 030/145] fix accents. --- src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml | 14 +++++++------- .../Accents/BaseLight.xaml | 14 +++++++------- .../Accents/FluentBaseDark.xaml | 14 +++++++------- .../Accents/FluentBaseLight.xaml | 16 ++++++++-------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml index 7ee211f249..7ce6c5a19f 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -4,13 +4,13 @@ - #FF0073CF - #FF1D85D7 - #FF3B97DF - #FF58A8E8 - #FF0064BE - #FF0055AD - #FF00459D + #FF0078D7 + #FF005A9E + #FF004275 + #FF002642 + #FF429CE3 + #FF76B9ED + #FFA6D8FF #FF000000 diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml index 309759705c..026edca4f9 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -4,13 +4,13 @@ - #FF0073CF - #FF1D85D7 - #FF3B97DF - #FF58A8E8 - #FF0064BE - #FF0055AD - #FF00459D + #FF0078D7 + #FF005A9E + #FF004275 + #FF002642 + #FF429CE3 + #FF76B9ED + #FFA6D8FF #FFFFFFFF diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index 0bd95eb108..c8761541e8 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - #FF0073CF + #FF0078D7 #FF000000 #FF000000 #FF000000 @@ -62,12 +62,12 @@ 1,1,1,1 1 - #FF1D85D7 - #FF3B97DF - #FF58A8E8 - #FF0064BE - #FF0055AD - #FF00459D + #FF005A9E + #FF004275 + #FF002642 + #FF429CE3 + #FF76B9ED + #FFA6D8FF #FF000000 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index 5ef54abeaf..65f4023318 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - #FF0073CF + #FF0078D7 #FFFFFFFF #FFFFFFFF #FFFFFFFF @@ -61,13 +61,13 @@ 1,1,1,1 1,1,1,1 1 - - #FF1D85D7 - #FF3B97DF - #FF58A8E8 - #FF0064BE - #FF0055AD - #FF00459D + + #FF005A9E + #FF004275 + #FF002642 + #FF429CE3 + #FF76B9ED + #FFA6D8FF #FFFFFFFF From 6e7656dfb6d95b9bcdaa1fb32cbb482357dd8011 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 14:12:22 -0300 Subject: [PATCH 031/145] fix checkbox glyph size. --- src/Avalonia.Themes.Fluent/CheckBox.xaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/CheckBox.xaml index fa6b044cf6..d1d7f36478 100644 --- a/src/Avalonia.Themes.Fluent/CheckBox.xaml +++ b/src/Avalonia.Themes.Fluent/CheckBox.xaml @@ -35,10 +35,12 @@ Width="20" CornerRadius="{DynamicResource ControlCornerRadius}" /> - - + + + + + - + @@ -208,7 +211,7 @@ - + @@ -286,5 +290,5 @@ + From d80403aca91821356870a2ac3ee7a6ce61c52352 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 15:02:39 -0300 Subject: [PATCH 032/145] add button resources --- .../Accents/FluentBaseDark.xaml | 14 +++++++ .../Accents/FluentBaseLight.xaml | 16 +++++++- .../Accents/FluentControlResourcesDark.xaml | 37 +++++++++++++++++++ .../Accents/FluentControlResourcesLight.xaml | 37 +++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index c8761541e8..ed6f56b211 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -71,6 +71,20 @@ #FF000000 + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index 65f4023318..ac7b792a9a 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -61,7 +61,7 @@ 1,1,1,1 1,1,1,1 1 - + #FF005A9E #FF004275 #FF002642 @@ -72,6 +72,20 @@ #FFFFFFFF + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 56c6de1144..a0f3ef0d62 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -2,6 +2,43 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 70bee7074e..ec4f35664c 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -2,6 +2,43 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + From 966519e23d844b58b03f05332361396f9d85ad5f Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 15:21:15 -0300 Subject: [PATCH 033/145] new button template. --- src/Avalonia.Themes.Fluent/Button.xaml | 98 ++++++++++++++++++++------ 1 file changed, 76 insertions(+), 22 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Button.xaml b/src/Avalonia.Themes.Fluent/Button.xaml index 698ddec2a8..42fcee6cd5 100644 --- a/src/Avalonia.Themes.Fluent/Button.xaml +++ b/src/Avalonia.Themes.Fluent/Button.xaml @@ -1,34 +1,88 @@ - + + + + +