From f2d5ca9e8571c39b563387cd1ea53d07d3909718 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 17:53:51 -0300 Subject: [PATCH 1/9] add resources for combobox. --- .../Accents/BaseDark.xaml | 1 + .../Accents/BaseLight.xaml | 1 + .../Accents/FluentBaseDark.xaml | 63 +++++++++- .../Accents/FluentBaseLight.xaml | 60 ++++++++++ .../Accents/FluentControlResourcesDark.xaml | 112 ++++++++++++++++++ .../Accents/FluentControlResourcesLight.xaml | 112 ++++++++++++++++++ src/Avalonia.Themes.Fluent/ComboBox.xaml | 37 +++++- 7 files changed, 378 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml index bf169400f0..9d3df07b14 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -138,6 +138,7 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml index b32c816851..07add26b99 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -138,6 +138,7 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index 57216c008a..7a715bbde7 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -85,7 +85,66 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -103,7 +162,7 @@ - + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index bf874ce3f1..5c6286a0bc 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -86,6 +86,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index ab83f4f474..7364c339f1 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -39,6 +39,118 @@ + + 21 + 64 + 80 + 240 + 1 + 1 + 0,0,0,4 + 2 + 11,5,11,7 + 11,11,11,13 + 11,11,11,13 + Normal + SemiLight + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0,4,0,4 + + + + + + 0 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 7c132dd22f..15e157f573 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -39,6 +39,118 @@ + + 21 + 64 + 80 + 240 + 1 + 1 + 0,0,0,4 + 2 + 11,5,11,7 + 11,11,11,13 + 11,11,11,13 + Normal + SemiLight + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0,4,0,4 + + + + + + 0 diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/ComboBox.xaml index 95bd9550a5..70d92fe141 100644 --- a/src/Avalonia.Themes.Fluent/ComboBox.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBox.xaml @@ -1,13 +1,38 @@ - + + + 0,0,0,4 + 15 + 7 + + 12,5,0,7 + 11,5,32,6 + 32 + + + + + Item 1 + Item 2 + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + From 01f5808fbb16a989b13c18038fc90fa7ca6de51f Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 28 May 2020 18:37:18 -0300 Subject: [PATCH 3/9] combobox item padding. --- src/Avalonia.Themes.Fluent/ComboBoxItem.xaml | 24 ++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml index 23456ec744..63688a79a7 100644 --- a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml @@ -1,9 +1,25 @@ + + + + + Item 1 + Item 2 + + + + Item 1 + Item 2 + + + + + - + - + - + - + From 566cb8b7d7eac0a21be3dbfcdb8806b1d4cc9727 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 29 May 2020 19:17:43 -0300 Subject: [PATCH 5/9] update combobox template. --- src/Avalonia.Themes.Fluent/ComboBox.xaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/ComboBox.xaml index 57b651233a..49553bbd8b 100644 --- a/src/Avalonia.Themes.Fluent/ComboBox.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBox.xaml @@ -2,7 +2,7 @@ - + Item 1 Item 2 @@ -36,6 +36,7 @@ + @@ -65,7 +66,14 @@ BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{DynamicResource ControlCornerRadius}" Opacity="0" /> - + - Date: Fri, 29 May 2020 19:18:01 -0300 Subject: [PATCH 6/9] Add placeholdertext properties to combobox --- src/Avalonia.Controls/ComboBox.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index e71bcc24a7..6557346b1f 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -51,6 +51,18 @@ namespace Avalonia.Controls public static readonly StyledProperty VirtualizationModeProperty = ItemsPresenter.VirtualizationModeProperty.AddOwner(); + /// + /// Defines the property. + /// + public static readonly StyledProperty PlaceholderTextProperty = + AvaloniaProperty.Register(nameof(PlaceholderText)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlaceholderForegroundProperty = + AvaloniaProperty.Register(nameof(PlaceholderForeground)); + private bool _isDropDownOpen; private Popup _popup; private object _selectionBoxItem; @@ -94,6 +106,24 @@ namespace Avalonia.Controls set { SetAndRaise(SelectionBoxItemProperty, ref _selectionBoxItem, value); } } + /// + /// Gets or sets the PlaceHolder text. + /// + public string PlaceholderText + { + get { return GetValue(PlaceholderTextProperty); } + set { SetValue(PlaceholderTextProperty, value); } + } + + /// + /// Gets or sets the Brush that renders the placeholder text. + /// + public IBrush PlaceholderForeground + { + get { return GetValue(PlaceholderForegroundProperty); } + set { SetValue(PlaceholderForegroundProperty, value); } + } + /// /// Gets or sets the virtualization mode for the items. /// From db5714c7cdb49d5d1ea9530b24d944363476ed95 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 29 May 2020 19:19:03 -0300 Subject: [PATCH 7/9] demo placeholder --- samples/ControlCatalog/Pages/ComboBoxPage.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/ControlCatalog/Pages/ComboBoxPage.xaml b/samples/ControlCatalog/Pages/ComboBoxPage.xaml index bbfbd4b4cd..486cc55d44 100644 --- a/samples/ControlCatalog/Pages/ComboBoxPage.xaml +++ b/samples/ControlCatalog/Pages/ComboBoxPage.xaml @@ -6,7 +6,7 @@ A drop-down list. - + Inline Items Inline Item 2 Inline Item 3 From 2d9b0c6b439c233e4d46198347d9f0f45b8b630e Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Fri, 29 May 2020 21:22:26 -0300 Subject: [PATCH 8/9] Add missing borders. Co-authored-by: Max Katz --- src/Avalonia.Themes.Fluent/ComboBoxItem.xaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml index d5c4ca538d..c26dec3d34 100644 --- a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml @@ -19,6 +19,8 @@ + + From d29f4144a9a08b7246587c6c21414f9ff4220265 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Fri, 29 May 2020 21:22:42 -0300 Subject: [PATCH 9/9] add missing margin Co-authored-by: Max Katz --- src/Avalonia.Themes.Fluent/ComboBox.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/ComboBox.xaml index 49553bbd8b..089052e73d 100644 --- a/src/Avalonia.Themes.Fluent/ComboBox.xaml +++ b/src/Avalonia.Themes.Fluent/ComboBox.xaml @@ -123,6 +123,7 @@