Browse Source

Don't apply templated parent if already set.

When applying the `TemplatedParent`, don't move into trees that already have the `TemplatedParent` property set - in this case we can assume that the templated parent has already been set for this tree, and it fixes the problem with menus added in the previous commit.
pull/8474/head
Steven Kirk 4 years ago
parent
commit
78a7257a5a
  1. 2
      src/Avalonia.Controls/Primitives/TemplatedControl.cs

2
src/Avalonia.Controls/Primitives/TemplatedControl.cs

@ -396,7 +396,7 @@ namespace Avalonia.Controls.Primitives
for (var i = 0; i < count; i++)
{
if (children[i] is IStyledElement child)
if (children[i] is IStyledElement child && child.TemplatedParent is null)
{
ApplyTemplatedParent(child, templatedParent);
}

Loading…
Cancel
Save