Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional changes to define Value property of Setter as XAML content property #9229

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Additional changes to make value as content property for setter
  • Loading branch information
anjali-wpf committed Jun 7, 2024
commit 8b8c105dac8bbb6c10ffb5c54961f3cfea7875a4
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 @@ -10,7 +10,7 @@ namespace System.Windows.Baml2006
{
partial class WpfSharedBamlSchemaContext: XamlSchemaContext
{
const int KnownPropertyCount = 270;
const int KnownPropertyCount = 272;


private WpfKnownMember CreateKnownMember(short bamlNumber)
Expand Down Expand Up @@ -286,6 +286,7 @@ private WpfKnownMember CreateKnownMember(short bamlNumber)
case 268: return Create_BamlProperty_XmlDataProvider_XmlSerializer();
case 269: return Create_BamlProperty_TextBox_IsReadOnly();
case 270: return Create_BamlProperty_RichTextBox_IsReadOnly();
case 272: return Create_BamlProperty_Setter_Value();
default:
throw new InvalidOperationException("Invalid BAML number");
}
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:
anjali-wpf marked this conversation as resolved.
Show resolved Hide resolved
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 @@ public partial class SessionEndingCancelEventArgs : System.ComponentModel.Cancel
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
Loading