Skip to content

Commit

Permalink
Additional changes to define Value property of Setter as XAML content…
Browse files Browse the repository at this point in the history
… property (#8534)

* Pushed additional changes to support Setter.Value property changes

* Changes to address feature test failures

* Addressed review comments
  • Loading branch information
anjali-wpf authored May 7, 2024
1 parent 13121b2 commit 8b7b7ad
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8844,6 +8844,7 @@ 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,8 @@ internal enum KnownProperties : short
XmlDataProvider_XmlSerializer,
MaxProperty,
TextBox_IsReadOnly,
RichTextBox_IsReadOnly
RichTextBox_IsReadOnly,
Setter_Value
}

#if !BAMLDASM
Expand Down Expand Up @@ -2786,6 +2787,9 @@ 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:
Expand Down Expand Up @@ -3676,6 +3680,10 @@ 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,6 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public DependencyProperty Property
/// </summary>
[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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ 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() { }
Expand Down

0 comments on commit 8b7b7ad

Please sign in to comment.