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 14616c02482..8c623516c79 100644 --- a/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt +++ b/src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt @@ -40,8 +40,8 @@ CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'S CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.ResourceDictionary' changed from '[LocalizabilityAttribute(16)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Ignore)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.ResourceDictionary.DeferrableContent' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.ResourceDictionary.Source' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation. +CannotRemoveAttribute : Attribute 'System.Windows.Markup.ContentPropertyAttribute' exists on 'System.Windows.Setter' in the contract but not the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Setter.Property' changed from '[LocalizabilityAttribute(0, Modifiability=0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Modifiability=Modifiability.Unmodifiable, Readability=Readability.Unreadable)]' in the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' exists on 'System.Windows.Setter.Value' in the contract but not the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.Setter.Value' changed from '[LocalizabilityAttribute(0, Readability=0)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.SetterBase' changed from '[LocalizabilityAttribute(16)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Ignore)]' in the implementation. CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.StaticResourceExtension' changed from '[LocalizabilityAttribute(17)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]' in the implementation. diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs index 987beeac7d7..0b2c324ad85 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs @@ -8844,7 +8844,6 @@ private WpfKnownType Create_BamlType_Setter(bool isBamlType, bool useV3Rules) typeof(System.Windows.Setter), isBamlType, useV3Rules); bamlType.DefaultConstructor = delegate() { return new System.Windows.Setter(); }; - bamlType.ContentPropertyName = "Value"; bamlType.Freeze(); return bamlType; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs index 37d78317e1d..cbd2d5bcd41 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs @@ -1107,8 +1107,7 @@ internal enum KnownProperties : short XmlDataProvider_XmlSerializer, MaxProperty, TextBox_IsReadOnly, - RichTextBox_IsReadOnly, - Setter_Value + RichTextBox_IsReadOnly } #if !BAMLDASM @@ -2787,9 +2786,6 @@ internal static string GetContentPropertyName(KnownElements knownElement) case KnownElements.ToolBarTray: name = "ToolBars"; break; - case KnownElements.Setter: - name = "Value"; - break; case KnownElements.ControlTemplate: case KnownElements.DataTemplate: case KnownElements.FrameworkTemplate: @@ -3680,10 +3676,6 @@ internal static short GetKnownPropertyAttributeId(KnownElements typeID, string f if (string.Equals(fieldName, "XmlSerializer", StringComparison.Ordinal)) return (short)KnownProperties.XmlDataProvider_XmlSerializer; break; - case KnownElements.Setter: - if (string.Equals(fieldName, "Value", StringComparison.Ordinal)) - return (short)KnownProperties.Setter_Value; - break; } return 0; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/StyleXamlParser.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/StyleXamlParser.cs index 1ff895daaea..17a7c5f1671 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/StyleXamlParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/StyleXamlParser.cs @@ -712,6 +712,14 @@ public override void WriteElementStart(XamlElementStartNode xamlElementStartNode _inEventSetter = true; #endif } + else if ((depth == 2 && _setterElementEncountered) || + (depth == 3 && _setterPropertyEncountered)) + { + ThrowException(nameof(SR.ParserNoSetterChild), + xamlElementStartNode.TypeFullName, + xamlElementStartNode.LineNumber, + xamlElementStartNode.LinePosition); + } } // Handle custom serializers within the style section by creating an instance diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Setter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Setter.cs index 12ac88c8fa5..789f5b838f9 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Setter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Setter.cs @@ -161,7 +161,6 @@ public DependencyProperty Property /// [System.Windows.Markup.DependsOn("Property")] [System.Windows.Markup.DependsOn("TargetName")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] // Not localizable by-default [TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))] public object Value diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs index 378f9504d27..64ab8a64dc1 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs @@ -1149,7 +1149,6 @@ internal SessionEndingCancelEventArgs() { } public delegate void SessionEndingCancelEventHandler(object sender, System.Windows.SessionEndingCancelEventArgs e); [System.Windows.Markup.XamlSetMarkupExtensionAttribute("ReceiveMarkupExtension")] [System.Windows.Markup.XamlSetTypeConverterAttribute("ReceiveTypeConverter")] - [System.Windows.Markup.ContentPropertyAttribute("Value")] public partial class Setter : System.Windows.SetterBase, System.ComponentModel.ISupportInitialize { public Setter() { }