UWP: How to assign a LayerVisual as the first child of a Panel

155 Views Asked by At

I am adding a LayerVisual to a Panel by invoking

LayerVisual layerVisual; // this is created using a Compositor in previous logic
Panel parent; // I get this Panel from my XAML
ElementCompositionPreview.SetElementChildVisual(parent, layerVisual);

Unfortunately using ElementCompositionPreview.SetElementChildVisual() I have two problems:

  1. I can set only one LayerVisual at a time
  2. such LayerVisual is placed on top of all the other elements (and I want instead it in the background)

Therefore, I would be happy to have a solution like

parent.Children.Insert(0, layerVisual);

but unfortunately the layerVisual is not an UIElement.

How can I achieve this result?

0

There are 0 best solutions below