diff --git a/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt b/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt index 7d0b04ebe0e..ebb1d41a9db 100644 --- a/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt +++ b/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt @@ -7,6 +7,7 @@ CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVi CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.DataTrigger.Binding' changed from '[LocalizabilityAttribute(0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.DataTrigger.Setters' changed from '[DesignerSerializationVisibilityAttribute(2)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.DataTrigger.Value' changed from '[LocalizabilityAttribute(0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)]' in the implementation. +TypesMustExist : Type 'System.Windows.ElementPlacement' does not exist in the implementation but it does exist in the contract. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.EventTrigger.Actions' changed from '[DesignerSerializationVisibilityAttribute(2)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.FrameworkContentElement.BindingGroup' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.FrameworkContentElement.BindingGroup' changed from '[LocalizabilityAttribute(17)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]' in the implementation. @@ -193,8 +194,20 @@ CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'S CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Controls.Panel' changed from '[LocalizabilityAttribute(16)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Ignore)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.Controls.Panel.Children' changed from '[DesignerSerializationVisibilityAttribute(2)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]' in the implementation. TypesMustExist : Type 'System.Windows.Controls.PassiveScrollViewer' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Windows.DependencyProperty System.Windows.DependencyProperty System.Windows.Controls.PasswordBox.IconPlacementProperty' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Windows.DependencyProperty System.Windows.DependencyProperty System.Windows.Controls.PasswordBox.IconProperty' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Windows.DependencyProperty System.Windows.DependencyProperty System.Windows.Controls.PasswordBox.PlaceholderEnabledProperty' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Windows.DependencyProperty System.Windows.DependencyProperty System.Windows.Controls.PasswordBox.PlaceholderTextProperty' does not exist in the implementation but it does exist in the contract. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.Controls.PasswordBox.Password' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.Controls.PasswordBox.SecurePassword' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. +MembersMustExist : Member 'public System.Windows.Controls.IconElement System.Windows.Controls.PasswordBox.Icon.get()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public void System.Windows.Controls.PasswordBox.Icon.set(System.Windows.Controls.IconElement)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Windows.Controls.ElementPlacement System.Windows.Controls.PasswordBox.IconPlacement.get()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public void System.Windows.Controls.PasswordBox.IconPlacement.set(System.Windows.Controls.ElementPlacement)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Boolean System.Windows.Controls.PasswordBox.PlaceholderEnabled.get()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public void System.Windows.Controls.PasswordBox.PlaceholderEnabled.set(System.Boolean)' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.String System.Windows.Controls.PasswordBox.PlaceholderText.get()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public void System.Windows.Controls.PasswordBox.PlaceholderText.set(System.String)' does not exist in the implementation but it does exist in the contract. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Controls.RadioButton' changed from '[LocalizabilityAttribute(9)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.RadioButton)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Controls.RadioButton.GroupName' changed from '[LocalizabilityAttribute(17)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Controls.RichTextBox' changed from '[LocalizabilityAttribute(15)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Inherit)]' in the implementation. @@ -360,4 +373,4 @@ CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVi CannotChangeAttribute : Attribute 'System.Windows.Markup.DesignerSerializationOptionsAttribute' on 'System.Windows.Markup.XmlAttributeProperties.GetXmlSpace(System.Windows.DependencyObject)' changed from '[DesignerSerializationOptionsAttribute(1)]' in the contract to '[DesignerSerializationOptionsAttribute(DesignerSerializationOptions.SerializeAsAttribute)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.Media.Animation.Storyboard.GetTarget(System.Windows.DependencyObject)' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Shapes.Shape' changed from '[LocalizabilityAttribute(0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)]' in the implementation. -Total Issues: 361 +Total Issues: 374 diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj index da3f94ce4fa..a15f64d9792 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/PresentationFramework.csproj @@ -416,6 +416,7 @@ + diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/PasswordBox.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/PasswordBox.cs index 2eb7a6eb5e1..ce8e33e5ed8 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/PasswordBox.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/PasswordBox.cs @@ -63,7 +63,7 @@ static PasswordBox() PasswordCharProperty.OverrideMetadata(typeof(PasswordBox), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnPasswordCharChanged))); - // Declaree listener for Padding property + // Declare listener for Padding property Control.PaddingProperty.OverrideMetadata(typeof(PasswordBox), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnPaddingChanged))); @@ -347,6 +347,82 @@ public bool IsSelectionActive get { return (bool)GetValue(IsSelectionActiveProperty); } } + /// + /// Defines which side the icon should be placed on. + /// + public ElementPlacement IconPlacement + { + get => (ElementPlacement)GetValue(IconPlacementProperty); + set => SetValue(IconPlacementProperty, value); + } + + /// + /// Property for . + /// + public static readonly DependencyProperty IconPlacementProperty = DependencyProperty.Register( + nameof(IconPlacement), + typeof(ElementPlacement), + typeof(PasswordBox), + new PropertyMetadata(ElementPlacement.Left) + ); + + /// + /// Gets or sets displayed . + /// + public IconElement Icon + { + get => (IconElement)GetValue(IconProperty); + set => SetValue(IconProperty, value); + } + + /// + /// Property for . + /// + public static readonly DependencyProperty IconProperty = DependencyProperty.Register( + nameof(Icon), + typeof(IconElement), + typeof(PasswordBox), + new PropertyMetadata(null, null, IconSourceElementConverter.ConvertToIconElement) + ); + + /// + /// Gets or sets numbers pattern. + /// + public string PlaceholderText + { + get => (string)GetValue(PlaceholderTextProperty); + set => SetValue(PlaceholderTextProperty, value); + } + + /// + /// Property for . + /// + public static readonly DependencyProperty PlaceholderTextProperty = DependencyProperty.Register( + nameof(PlaceholderText), + typeof(string), + typeof(PasswordBox), + new PropertyMetadata(String.Empty) + ); + + /// + /// Gets or sets a value determining whether to display the placeholder. + /// + public bool PlaceholderEnabled + { + get => (bool)GetValue(PlaceholderEnabledProperty); + set => SetValue(PlaceholderEnabledProperty, value); + } + + /// + /// Property for . + /// + public static readonly DependencyProperty PlaceholderEnabledProperty = DependencyProperty.Register( + nameof(PlaceholderEnabled), + typeof(bool), + typeof(PasswordBox), + new PropertyMetadata(true) + ); + /// /// /// @@ -854,7 +930,7 @@ private void Initialize() // PasswordBox only accepts plain text, so change TextEditor's default to that. _textEditor.AcceptsRichContent = false; - // PasswordBox does not accetps tabs. + // PasswordBox does not accepts tabs. _textEditor.AcceptsTab = false; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ElementPlacement.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ElementPlacement.cs new file mode 100644 index 00000000000..2868c81a8a8 --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ElementPlacement.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace System.Windows +{ + /// + /// Decides where to put the element. + /// + public enum ElementPlacement + { + /// + /// Puts the control element on the left. + /// + Left, + + /// + /// Puts the control element on the right. + /// + Right + } +} diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Win11/Styles/PasswordBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Win11/Styles/PasswordBox.xaml new file mode 100644 index 00000000000..fdb759a9799 --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Win11/Styles/PasswordBox.xaml @@ -0,0 +1,281 @@ + + + + + 1,1,1,0 + 0,0,0,1 + 10,8,0,0 + 0,8,10,0 + 0,5,4,0 + 0,0,0,0 + 24 + 14 + + + + + + + + + + +