Skip to content

Commit

Permalink
Correct node ordering when reading markup extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vwoodzell committed Apr 30, 2013
1 parent 6347c22 commit 565f726
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,16 @@ void ReadPropertyComplexEnd()
XmlBamlProperty property =
new XmlBamlProperty(elements.Peek(), PropertyType.Complex, propertyElement.PropertyDeclaration);
property.Value = sb.ToString();
nodes.Add(property);

// insert the replacement property after the last attribute of the parent element
int elementIndex = nodes.IndexOf(propertyElement.Parent);
int attributeIndex;
for (attributeIndex = elementIndex + 1; attributeIndex < nodes.Count; attributeIndex++)
{
if (!(nodes[attributeIndex] is XmlBamlProperty) && !(nodes[attributeIndex] is XmlBamlSimpleProperty))
break;
}
nodes.Insert(attributeIndex, property);
}
}

Expand Down

0 comments on commit 565f726

Please sign in to comment.