-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Title
Win11 Theming of Controls - Changes in Controls
Background and motivation
The current WPF controls appear outdated and are not visually consistent with the newly rejuvenated Windows UI. This issue has been identified as the most frequently requested feature [276 Upvotes] (#7555) by the development community. The lack of visually appealing WPF controls makes the platform look outdated. A solution is required to update WPF controls to match the modern Windows UI and improve the aesthetic appeal of WPF applications. The proposal adds relevant properties and methods to the controls classes for using them inside the xaml.
Part of effort - #8655
API Pages
TextBox class
Represents a control that can be used to display or edit unformatted text.
Adding new property PlaceholderText to TextBox
TextBox.Placeholder
This property get or set the placeholder text in the TextBox.
Placeholder text is usually displayed when there is no text input in the TextBox.
Usage
To add a text ("Enter some text") to a TextBox when there is no input.
<TextBox Placeholder="Enter some Text" />
<TextBox>
<TextBox.Placeholder>
<StackPanel Orientation="Horizontal">
<TextBlock Text="" Margin="2" FontFamily="Segoe Fluent Icons" />
<TextBlock Text="Search ..." Margin="2"/>
</StackPanel>
</TextBox.Placeholder>
</TextBox>API Details
public partial class TextBox : System.Windows.Controls.Primitives.TextBoxBase, System.Windows.Markup.IAddChild
{
+ public static readonly System.Windows.DependencyProperty PlaceholderProperty;
+ public object Placeholder { get { throw null; } set { } }
//Protected properties
+ protected override void OnGotFocus(System.Windows.RoutedEventArgs e) { }
+ protected override void OnLostFocus(System.Windows.RoutedEventArgs e) { }
+ protected override void OnTextChanged(System.Windows.Controls.TextChangedEventArgs e) { }
}
PasswordBox class
Represents a control designed for entering and handling passwords.
Adding properties for Placeholder ( other properties will be introduced iteratively )
PasswordBox.Placeholder
This property get or set the placeholder text in the PasswordBox.
Placeholder text is usually displayed when there is no password input in the PasswordBox.
Usage
To add a text ("Enter your password") to a PasswordBox when there is no input password.
<PasswordBox PlaceholderText="Enter your password" />API Details
public sealed partial class PasswordBox : System.Windows.Controls.Control
{
+ public static readonly System.Windows.DependencyProperty PlaceholderProperty;
+ public object Placeholder { get { throw null; } set { } }
}
ComboBox class
Represents a selection control with a drop-down list that can be shown or hidden by clicking the arrow on the control.
Adding properties for Placeholder ( other properties will be introduced iteratively )
ComboBox.Placeholder
This property get or set the placeholder text in the ComboBox.
Placeholder text is usually displayed when there is no password input in the PasswordBox.
Usage
To add a text ("Enter your password") to a PasswordBox when there is no input password.
<ComboBox PlaceholderText="Enter your password" />
<ComboBox ItemsSource="{StaticResource ComboBoxItemsList}"
PlaceholderText="Select City..."
IsEditable="true"
IsReadOnly="true"/>API Details
public sealed partial class PasswordBox : System.Windows.Controls.Control
{
+ public static readonly System.Windows.DependencyProperty PlaceholderProperty;
+ public object Placeholder { get { throw null; } set { } }
}
Risks
No response
cc: @dotnet/dotnet-wpf-triage @pomianowski
Metadata
Metadata
Assignees
Labels
Type
Projects
Status