From d1156c7f1f697fe237810a146bf698d4adc8f184 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Tue, 27 Oct 2020 20:32:41 +0200 Subject: [PATCH 01/18] remove redundant check for renderer so app can request macos native invalidate of window --- src/Avalonia.Native/WindowImplBase.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index 824f62aee5..0ecf8f856a 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -341,8 +341,7 @@ namespace Avalonia.Native public void Invalidate(Rect rect) { - if (!_deferredRendering && _native != null) - _native.Invalidate(new AvnRect { Height = rect.Height, Width = rect.Width, X = rect.X, Y = rect.Y }); + _native?.Invalidate(new AvnRect { Height = rect.Height, Width = rect.Width, X = rect.X, Y = rect.Y }); } public void SetInputRoot(IInputRoot inputRoot) From 88f575ec08a411b8e24a0965c6fe902035b17910 Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 28 Oct 2020 11:35:17 +0100 Subject: [PATCH 02/18] Add ElementName to tree node --- .../Diagnostics/ViewModels/TreeNode.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs index d9a0d17518..9363c28705 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs @@ -23,6 +23,8 @@ namespace Avalonia.Diagnostics.ViewModels if (visual is IControl control) { + ElementName = control.Name; + var removed = Observable.FromEventPattern( x => control.DetachedFromLogicalTree += x, x => control.DetachedFromLogicalTree -= x); @@ -61,6 +63,11 @@ namespace Avalonia.Diagnostics.ViewModels private set { RaiseAndSetIfChanged(ref _classes, value); } } + public string ElementName + { + get; + } + public IVisual Visual { get; From 536a193f71fbe4047dbc6753ad39175484410b3a Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 28 Oct 2020 11:35:39 +0100 Subject: [PATCH 03/18] Change TextBox inside DataGrid selection brush --- .../Diagnostics/Views/ControlDetailsView.xaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml index b2d3a8bddb..8aad5fffd8 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml @@ -26,6 +26,12 @@ + + + + From baa469b97eb53fdd2b737056aa829839e635203e Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 28 Oct 2020 11:35:56 +0100 Subject: [PATCH 04/18] Fix default size of panels --- src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml index a1e6ca7d37..2796ef0254 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:Avalonia.Diagnostics.ViewModels" x:Class="Avalonia.Diagnostics.Views.TreePageView"> - + + From 89047a2baf9060557db318b38d43a0c971d9d7ca Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 12:47:41 +0000 Subject: [PATCH 05/18] add resolvebyname attribute to attached property setter methods for compatibility with resharper. --- .../RelativePanel.AttachedProperties.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs b/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs index f64c26682b..562b104b04 100644 --- a/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs +++ b/src/Avalonia.Controls/RelativePanel.AttachedProperties.cs @@ -55,6 +55,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to position this element above.) + [ResolveByName] public static void SetAbove(AvaloniaObject obj, object value) { obj.SetValue(AboveProperty, value); @@ -121,6 +122,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's bottom edge with.) + [ResolveByName] public static void SetAlignBottomWith(AvaloniaObject obj, object value) { obj.SetValue(AlignBottomWithProperty, value); @@ -185,6 +187,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's horizontal center with.) + [ResolveByName] public static void SetAlignHorizontalCenterWith(AvaloniaObject obj, object value) { obj.SetValue(AlignHorizontalCenterWithProperty, value); @@ -250,6 +253,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's left edge with.) + [ResolveByName] public static void SetAlignLeftWith(AvaloniaObject obj, object value) { obj.SetValue(AlignLeftWithProperty, value); @@ -315,6 +319,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's right edge with.) + [ResolveByName] public static void SetAlignRightWith(AvaloniaObject obj, object value) { obj.SetValue(AlignRightWithProperty, value); @@ -376,6 +381,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's top edge with.) + [ResolveByName] public static void SetAlignTopWith(AvaloniaObject obj, object value) { obj.SetValue(AlignTopWithProperty, value); @@ -437,7 +443,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to align this element's horizontal center with.) - + [ResolveByName] public static void SetAlignVerticalCenterWith(AvaloniaObject obj, object value) { obj.SetValue(AlignVerticalCenterWithProperty, value); @@ -468,7 +474,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to position this element below.) - + [ResolveByName] public static void SetBelow(AvaloniaObject obj, object value) { obj.SetValue(BelowProperty, value); @@ -500,6 +506,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to position this element to the left of.) + [ResolveByName] public static void SetLeftOf(AvaloniaObject obj, object value) { obj.SetValue(LeftOfProperty, value); @@ -531,6 +538,7 @@ namespace Avalonia.Controls /// /// The object to which the property value is written. /// The value to set. (The element to position this element to the right of.) + [ResolveByName] public static void SetRightOf(AvaloniaObject obj, object value) { obj.SetValue(RightOfProperty, value); From 8f51fae0d93a2a345f68528462435d6b55b7d994 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 12:50:45 +0000 Subject: [PATCH 06/18] update comment for ResolveByName attribute. --- src/Avalonia.Controls/ResolveByNameAttribute.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/ResolveByNameAttribute.cs b/src/Avalonia.Controls/ResolveByNameAttribute.cs index a00e3f8a1b..a13b10d630 100644 --- a/src/Avalonia.Controls/ResolveByNameAttribute.cs +++ b/src/Avalonia.Controls/ResolveByNameAttribute.cs @@ -2,8 +2,12 @@ namespace Avalonia.Controls { + /// + /// Indicates that the property resolves an element by Name or x:Name. + /// When applying this to attached properties, ensure to put on both + /// the Getter and Setter methods. + /// public class ResolveByNameAttribute : Attribute { - } } From b42433e4956267b34e050db0951a4bc96e92e47a Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 28 Oct 2020 14:00:19 +0100 Subject: [PATCH 07/18] Increase width a bit more --- src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml b/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml index 2796ef0254..98de9b611e 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Views/TreePageView.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:Avalonia.Diagnostics.ViewModels" x:Class="Avalonia.Diagnostics.Views.TreePageView"> - + Date: Wed, 28 Oct 2020 19:47:20 +0000 Subject: [PATCH 08/18] change template for datavalidation errors. --- .../DataValidationErrors.xaml | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml index 902fc74c0c..1161a92e30 100644 --- a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml +++ b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml @@ -14,39 +14,31 @@ - - + + - - - - - - - - - - + + + + + + + From 9e0b33b542b2c33bdb3526bef5c7f988d43a6e07 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 20:40:52 +0000 Subject: [PATCH 09/18] add an example of datavalidation errors on textbox. --- samples/ControlCatalog/Pages/TextBoxPage.xaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/samples/ControlCatalog/Pages/TextBoxPage.xaml b/samples/ControlCatalog/Pages/TextBoxPage.xaml index 8b07ac3f85..4958174f40 100644 --- a/samples/ControlCatalog/Pages/TextBoxPage.xaml +++ b/samples/ControlCatalog/Pages/TextBoxPage.xaml @@ -1,6 +1,7 @@ + x:Class="ControlCatalog.Pages.TextBoxPage" + xmlns:sys="clr-namespace:System;assembly=netstandard"> @@ -11,12 +12,18 @@ Spacing="16"> - + + + + + + + Date: Wed, 28 Oct 2020 20:41:14 +0000 Subject: [PATCH 10/18] position datavalidation errors underneath textbox. --- src/Avalonia.Themes.Fluent/TextBox.xaml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/TextBox.xaml b/src/Avalonia.Themes.Fluent/TextBox.xaml index 162835ae10..2303c438fc 100644 --- a/src/Avalonia.Themes.Fluent/TextBox.xaml +++ b/src/Avalonia.Themes.Fluent/TextBox.xaml @@ -37,15 +37,8 @@ - - - - + + - - - + - From cc712b6e0f8e3eab9e275f036a838fdf6dab6715 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 20:49:30 +0000 Subject: [PATCH 11/18] wrap control in datavalidation errors so it can be applied consistently. --- src/Avalonia.Themes.Fluent/DataValidationErrors.xaml | 2 +- src/Avalonia.Themes.Fluent/TextBox.xaml | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml index 1161a92e30..ed31f7b573 100644 --- a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml +++ b/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml @@ -14,7 +14,7 @@ - - - - + - + From 76d3d013e34e0a1d9cd91daf0a319910f77f60c5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 21:36:35 +0000 Subject: [PATCH 12/18] add datavalidations to button spinner. --- .../Pages/ButtonSpinnerPage.xaml | 11 ++- src/Avalonia.Themes.Fluent/ButtonSpinner.xaml | 99 ++++++++++--------- 2 files changed, 61 insertions(+), 49 deletions(-) diff --git a/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml b/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml index c3f9f65dd9..4ac2330403 100644 --- a/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml +++ b/samples/ControlCatalog/Pages/ButtonSpinnerPage.xaml @@ -1,6 +1,7 @@  + x:Class="ControlCatalog.Pages.ButtonSpinnerPage" + xmlns:sys="clr-namespace:System;assembly=netstandard"> ButtonSpinner @@ -19,6 +20,14 @@ ShowButtonSpinner="{Binding #showSpinCheck.IsChecked}"> + + + + + + diff --git a/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml b/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml index 82265ea282..12b4845522 100644 --- a/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml +++ b/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml @@ -65,56 +65,59 @@ - - - + + + + - - - - + + + + - - - - - - + + + + + + + From 62ca81e9fbfbba9a3436553d4a4d8bb4f108b98b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 21:49:41 +0000 Subject: [PATCH 13/18] add datavalidation errors to combobox. --- .../ControlCatalog/Pages/ComboBoxPage.xaml | 13 +- src/Avalonia.Controls/Primitives/Popup.cs | 1 + src/Avalonia.Themes.Fluent/ComboBox.xaml | 201 +++++++++--------- 3 files changed, 117 insertions(+), 98 deletions(-) diff --git a/samples/ControlCatalog/Pages/ComboBoxPage.xaml b/samples/ControlCatalog/Pages/ComboBoxPage.xaml index 369f703718..025b85492c 100644 --- a/samples/ControlCatalog/Pages/ComboBoxPage.xaml +++ b/samples/ControlCatalog/Pages/ComboBoxPage.xaml @@ -1,6 +1,7 @@ + x:Class="ControlCatalog.Pages.ComboBoxPage" + xmlns:sys="clr-namespace:System;assembly=netstandard"> ComboBox A drop-down list. @@ -35,6 +36,16 @@ + + + Inline Items + Inline Item 2 + Inline Item 3 + Inline Item 4 + + + + diff --git a/src/Avalonia.Controls/Primitives/Popup.cs b/src/Avalonia.Controls/Primitives/Popup.cs index becb489557..b445de0472 100644 --- a/src/Avalonia.Controls/Primitives/Popup.cs +++ b/src/Avalonia.Controls/Primitives/Popup.cs @@ -265,6 +265,7 @@ namespace Avalonia.Controls.Primitives /// /// Gets or sets the control that is used to determine the popup's position. /// + [ResolveByName] public Control? PlacementTarget { get { return GetValue(PlacementTargetProperty); } diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/ComboBox.xaml index 8155264f18..2eee656dc6 100644 --- a/src/Avalonia.Themes.Fluent/ComboBox.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBox.xaml @@ -44,105 +44,107 @@ - - + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - + Grid.Column="1" + IsHitTestVisible="False" + Margin="0,0,10,0" + Height="12" + Width="12" + HorizontalAlignment="Right" + VerticalAlignment="Center"> + + + + + + + + + + + + + + @@ -232,4 +234,9 @@ + + + From 18ac4010070cfb1e77502fb34840da45bce67958 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 21:56:12 +0000 Subject: [PATCH 14/18] add example of datavalidation on autocomplete box. --- samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml index a49616e543..1a53217842 100644 --- a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml +++ b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml @@ -1,5 +1,6 @@ AutoCompleteBox @@ -56,6 +57,16 @@ Width="200" Margin="0,0,0,8" FilterMode="None"/> + + + + + + + From a0ce794c41a15aa336e36d96af45361b9ebc27dc Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 28 Oct 2020 22:02:49 +0000 Subject: [PATCH 15/18] make numeric up down work with validation errors. --- samples/ControlCatalog/Pages/NumericUpDownPage.xaml | 10 ++++++++++ src/Avalonia.Themes.Fluent/NumericUpDown.xaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml index 0d7e5da17f..d75622f1fb 100644 --- a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml +++ b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml @@ -1,5 +1,6 @@  Numeric up-down control @@ -75,6 +76,15 @@ + + NumericUpDown with Validation Errors: + + + + + diff --git a/src/Avalonia.Themes.Fluent/NumericUpDown.xaml b/src/Avalonia.Themes.Fluent/NumericUpDown.xaml index cc5e2234f8..1da48ebd8a 100644 --- a/src/Avalonia.Themes.Fluent/NumericUpDown.xaml +++ b/src/Avalonia.Themes.Fluent/NumericUpDown.xaml @@ -39,6 +39,7 @@ VerticalContentAlignment="Stretch" AllowSpin="{TemplateBinding AllowSpin}" ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" + DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"> Date: Wed, 28 Oct 2020 22:22:43 +0000 Subject: [PATCH 16/18] add datavalidation to date and time pickers. --- .../Pages/DateTimePickerPage.xaml | 20 +++ src/Avalonia.Themes.Fluent/DatePicker.xaml | 143 +++++++-------- src/Avalonia.Themes.Fluent/TimePicker.xaml | 164 +++++++++--------- 3 files changed, 180 insertions(+), 147 deletions(-) diff --git a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml index af6b6e8605..45056a9a76 100644 --- a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml +++ b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:sys="clr-namespace:System;assembly=netstandard" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="ControlCatalog.Pages.DateTimePickerPage"> @@ -30,6 +31,16 @@ + + + + + + + + + A DatePicker with day formatted and year hidden. + + + + + + + + A TimePicker with a header and minute increments specified. diff --git a/src/Avalonia.Themes.Fluent/DatePicker.xaml b/src/Avalonia.Themes.Fluent/DatePicker.xaml index 6fbfa1bbf7..b6e36861e0 100644 --- a/src/Avalonia.Themes.Fluent/DatePicker.xaml +++ b/src/Avalonia.Themes.Fluent/DatePicker.xaml @@ -125,77 +125,79 @@ - - + + + - + - - - + + + - + + @@ -228,6 +230,11 @@ + + + @@ -161,6 +163,10 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -102,56 +104,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -260,4 +264,8 @@ + + From 233fdc9289cb6125f18c8566e157c711224eb576 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 29 Oct 2020 11:30:18 +0000 Subject: [PATCH 18/18] make slider track red when there is an error. --- src/Avalonia.Themes.Fluent/Slider.xaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/Slider.xaml b/src/Avalonia.Themes.Fluent/Slider.xaml index 8abba461e7..d70eb1abe3 100644 --- a/src/Avalonia.Themes.Fluent/Slider.xaml +++ b/src/Avalonia.Themes.Fluent/Slider.xaml @@ -268,4 +268,8 @@ + +