Skip to content

Commit 6548fdd

Browse files
author
Anjali
authored
Additional changes to make value as content property for setter (#9229)
1 parent f29acba commit 6548fdd

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

src/Microsoft.DotNet.Wpf/ApiCompat/Baselines/PresentationFramework-ref.baseline.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'S
4040
CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.ResourceDictionary' changed from '[LocalizabilityAttribute(16)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Ignore)]' in the implementation.
4141
CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.ResourceDictionary.DeferrableContent' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation.
4242
CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' on 'System.Windows.ResourceDictionary.Source' changed from '[DesignerSerializationVisibilityAttribute(0)]' in the contract to '[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]' in the implementation.
43-
CannotRemoveAttribute : Attribute 'System.Windows.Markup.ContentPropertyAttribute' exists on 'System.Windows.Setter' in the contract but not the implementation.
4443
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.
44+
CannotRemoveAttribute : Attribute 'System.ComponentModel.DesignerSerializationVisibilityAttribute' exists on 'System.Windows.Setter.Value' in the contract but not the implementation.
4545
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.
4646
CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.SetterBase' changed from '[LocalizabilityAttribute(16)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.Ignore)]' in the implementation.
4747
CannotChangeAttribute : Attribute 'System.Windows.LocalizabilityAttribute' on 'System.Windows.StaticResourceExtension' changed from '[LocalizabilityAttribute(17)]' in the contract to '[LocalizabilityAttribute(LocalizationCategory.NeverLocalize)]' in the implementation.

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownProperties.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace System.Windows.Baml2006
1010
{
1111
partial class WpfSharedBamlSchemaContext: XamlSchemaContext
1212
{
13-
const int KnownPropertyCount = 270;
13+
const int KnownPropertyCount = 272;
1414

1515

1616
private WpfKnownMember CreateKnownMember(short bamlNumber)
@@ -286,6 +286,7 @@ private WpfKnownMember CreateKnownMember(short bamlNumber)
286286
case 268: return Create_BamlProperty_XmlDataProvider_XmlSerializer();
287287
case 269: return Create_BamlProperty_TextBox_IsReadOnly();
288288
case 270: return Create_BamlProperty_RichTextBox_IsReadOnly();
289+
case 272: return Create_BamlProperty_Setter_Value();
289290
default:
290291
throw new InvalidOperationException("Invalid BAML number");
291292
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfGeneratedKnownTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8844,6 +8844,7 @@ private WpfKnownType Create_BamlType_Setter(bool isBamlType, bool useV3Rules)
88448844
typeof(System.Windows.Setter),
88458845
isBamlType, useV3Rules);
88468846
bamlType.DefaultConstructor = delegate() { return new System.Windows.Setter(); };
8847+
bamlType.ContentPropertyName = "Value";
88478848
bamlType.Freeze();
88488849
return bamlType;
88498850
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@ internal enum KnownProperties : short
11071107
XmlDataProvider_XmlSerializer,
11081108
MaxProperty,
11091109
TextBox_IsReadOnly,
1110-
RichTextBox_IsReadOnly
1110+
RichTextBox_IsReadOnly,
1111+
Setter_Value
11111112
}
11121113

11131114
#if !BAMLDASM
@@ -2786,6 +2787,9 @@ internal static string GetContentPropertyName(KnownElements knownElement)
27862787
case KnownElements.ToolBarTray:
27872788
name = "ToolBars";
27882789
break;
2790+
case KnownElements.Setter:
2791+
name = "Value";
2792+
break;
27892793
case KnownElements.ControlTemplate:
27902794
case KnownElements.DataTemplate:
27912795
case KnownElements.FrameworkTemplate:
@@ -3676,6 +3680,10 @@ internal static short GetKnownPropertyAttributeId(KnownElements typeID, string f
36763680
if (string.Equals(fieldName, "XmlSerializer", StringComparison.Ordinal))
36773681
return (short)KnownProperties.XmlDataProvider_XmlSerializer;
36783682
break;
3683+
case KnownElements.Setter:
3684+
if (string.Equals(fieldName, "Value", StringComparison.Ordinal))
3685+
return (short)KnownProperties.Setter_Value;
3686+
break;
36793687
}
36803688
return 0;
36813689
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/StyleXamlParser.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,6 @@ public override void WriteElementStart(XamlElementStartNode xamlElementStartNode
712712
_inEventSetter = true;
713713
#endif
714714
}
715-
else if ((depth == 2 && _setterElementEncountered) ||
716-
(depth == 3 && _setterPropertyEncountered))
717-
{
718-
ThrowException(nameof(SR.ParserNoSetterChild),
719-
xamlElementStartNode.TypeFullName,
720-
xamlElementStartNode.LineNumber,
721-
xamlElementStartNode.LinePosition);
722-
}
723715
}
724716

725717
// Handle custom serializers within the style section by creating an instance

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Setter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public DependencyProperty Property
161161
/// </summary>
162162
[System.Windows.Markup.DependsOn("Property")]
163163
[System.Windows.Markup.DependsOn("TargetName")]
164+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
164165
[Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] // Not localizable by-default
165166
[TypeConverter(typeof(System.Windows.Markup.SetterTriggerConditionValueConverter))]
166167
public object Value

src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,7 @@ internal SessionEndingCancelEventArgs() { }
11491149
public delegate void SessionEndingCancelEventHandler(object sender, System.Windows.SessionEndingCancelEventArgs e);
11501150
[System.Windows.Markup.XamlSetMarkupExtensionAttribute("ReceiveMarkupExtension")]
11511151
[System.Windows.Markup.XamlSetTypeConverterAttribute("ReceiveTypeConverter")]
1152+
[System.Windows.Markup.ContentPropertyAttribute("Value")]
11521153
public partial class Setter : System.Windows.SetterBase, System.ComponentModel.ISupportInitialize
11531154
{
11541155
public Setter() { }

0 commit comments

Comments
 (0)