Skip to content

Commit

Permalink
styles: support Replace in Appended control
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Feb 20, 2022
1 parent eafcfab commit 0aff84b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ void ProcessControlList(List<ResolvedControl> list, ResolvedTreeNode parent)
list[i] = ProcessWrapping(list[i]);
list[i] = ProcessReplacement(list[i]);
}
ProcessAppendAndPrepend(list);
ProcessAppendAndPrepend(list, parent);
SetParent(list, parent);
}

void ProcessAppendAndPrepend(List<ResolvedControl> list)
void ProcessAppendAndPrepend(List<ResolvedControl> list, ResolvedTreeNode parent)
{
var controls = list.ToArray();
list.Clear();
Expand All @@ -86,14 +86,16 @@ void ProcessAppendAndPrepend(List<ResolvedControl> list)
if (c.Properties.TryGetValue(PrependProperty, out var prependSetter))
{
c.Properties.Remove(PrependProperty);
var prepend = ((ResolvedPropertyControlCollection)prependSetter).Controls.ToArray();
var prepend = ((ResolvedPropertyControlCollection)prependSetter).Controls.ToList();
ProcessControlList(prepend, parent);
list.AddRange(prepend);
}
list.Add(c);
if (c.Properties.TryGetValue(AppendProperty, out var appendSetter))
{
c.Properties.Remove(AppendProperty);
var append = ((ResolvedPropertyControlCollection)appendSetter).Controls.ToArray();
var append = ((ResolvedPropertyControlCollection)appendSetter).Controls.ToList();
ProcessControlList(append, parent);
list.AddRange(append);
}
}
Expand Down

0 comments on commit 0aff84b

Please sign in to comment.