From 5b015d54dc09c4ae1cee7d7f41fbbc14a5fe96ba Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Thu, 19 Mar 2026 17:27:50 +0800
Subject: [PATCH] Update Placeholder properties to use TextBox as owner in
NumericUpDown & ComboBox (#20929)
* feat: update PlaceholderText and PlaceholderForeground properties to use TextBox as owner in NumericUpDown and ComboBox.
* chore: disable warning.
---
src/Avalonia.Controls/ComboBox.cs | 4 ++--
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs
index c977ca0a38..eb1eab5856 100644
--- a/src/Avalonia.Controls/ComboBox.cs
+++ b/src/Avalonia.Controls/ComboBox.cs
@@ -62,13 +62,13 @@ namespace Avalonia.Controls
/// Defines the property.
///
public static readonly StyledProperty PlaceholderTextProperty =
- AvaloniaProperty.Register(nameof(PlaceholderText));
+ TextBox.PlaceholderTextProperty.AddOwner();
///
/// Defines the property.
///
public static readonly StyledProperty PlaceholderForegroundProperty =
- AvaloniaProperty.Register(nameof(PlaceholderForeground));
+ TextBox.PlaceholderForegroundProperty.AddOwner();
///
/// Defines the property.
diff --git a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
index ddaa57f2f2..2f901860ba 100644
--- a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
+++ b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
@@ -112,7 +112,9 @@ namespace Avalonia.Controls
/// Defines the property.
///
public static readonly StyledProperty PlaceholderTextProperty =
- AvaloniaProperty.Register(nameof(PlaceholderText));
+#pragma warning disable AVP1013
+ TextBox.PlaceholderTextProperty.AddOwner();
+#pragma warning restore AVP1013
///
/// Defines the property.