WindowsCompositionSamples icon indicating copy to clipboard operation
WindowsCompositionSamples copied to clipboard

BackDrop control does not Initialize SurfaceLoader

Open darenm opened this issue 8 years ago • 2 comments

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);

darenm avatar Jul 29 '16 15:07 darenm

You should try to initial SurfaceLoader in your page's constructor.

SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

JuniperPhoton avatar Aug 15 '16 05:08 JuniperPhoton

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 :)

likuba avatar Oct 10 '17 23:10 likuba