Skip to content

Commit

Permalink
fix(xbind): Don't set bindings on x:Load on the actual element
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Apr 27, 2021
1 parent b48bf0f commit bb0d65e
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2771,9 +2771,16 @@ private void BuildExtendedProperties(IIndentedStringBuilder outerwriter, XamlObj

if (HasMarkupExtension(member))
{
TryValidateContentPresenterBinding(writer, objectDefinition, member);
if (!IsXLoadMember(member))
{
TryValidateContentPresenterBinding(writer, objectDefinition, member);

BuildComplexPropertyValue(writer, member, closureName + ".", closureName);
BuildComplexPropertyValue(writer, member, closureName + ".", closureName);
}
else
{
writer.AppendLineInvariant($"/* Skipping x:Load attribute already applied to ElementStub */");
}
}
else if (HasCustomMarkupExtension(member))
{
Expand Down Expand Up @@ -2941,8 +2948,7 @@ private void BuildExtendedProperties(IIndentedStringBuilder outerwriter, XamlObj
{
writer.AppendLineInvariant("// DeferLoadStrategy {0}", member.Value);
}
else if (member.Member.Name == "Load"
&& member.Member.PreferredXamlNamespace == XamlConstants.XamlXmlNamespace)
else if (IsXLoadMember(member))
{
writer.AppendLineInvariant("// Load {0}", member.Value);
}
Expand Down Expand Up @@ -3125,6 +3131,10 @@ void BuildCustomMarkupExtensionPropertyValue(IIndentedStringBuilder writer, Xaml
}
}

private bool IsXLoadMember(XamlMemberDefinition member) =>
member.Member.Name == "Load"
&& member.Member.PreferredXamlNamespace == XamlConstants.XamlXmlNamespace;

private void GenerateInlineEvent(string? closureName, IIndentedStringBuilder writer, XamlMemberDefinition member, IEventSymbol eventSymbol)
{
// If a binding is inside a DataTemplate, the binding root in the case of an x:Bind is
Expand Down Expand Up @@ -5317,14 +5327,6 @@ private IEnumerable<XamlObjectDefinition> EnumerateSubElements(IEnumerable<XamlO
{
writer.AppendLineInvariant($"that.Bindings.UpdateResources();");
}

if (nameMember != null)
{
using (writer.BlockInvariant("else"))
{
writer.AppendLineInvariant($"{componentName}_update_subject_capture.ElementInstance = null;");
}
}
}
}

Expand Down

0 comments on commit bb0d65e

Please sign in to comment.