WindowsCompositionSamples
WindowsCompositionSamples copied to clipboard
BackDrop control does not Initialize SurfaceLoader
If the BackDrop control is used prior to some other object initializing the SurfaceLoader with the appropriate Compositor, an exception is thrown. I added the following to the BackDrop constructor:
public BackDrop()
{
m_rootVisual = ElementCompositionPreview.GetElementVisual(this as UIElement);
Compositor = m_rootVisual.Compositor;
// Ensure the BackDrop control initializes the SurfaceLoader
// If the BackDrop control is used on it's own, an exception is thrown.
SurfaceLoader.Initialize(Compositor);
You should try to initial SurfaceLoader in your page's constructor.
SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);
Hey @darenm If this solved your issues, it'd be great if you could make a PR with this update and we'll make sure to take a look and review :)