From 9b24d68d717c09c2206a75441c3e5a7b8f10cd45 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 29 May 2020 19:18:01 -0300 Subject: [PATCH] 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. ///