Example #1
0
        protected override void OnConnected(UIElement newElement)
        {
            if (newElement == null)
            {
                return;
            }

            Compositor compositor = Window.Current.Compositor;

            // Create AmbientLight and set its properties
            AmbientLight ambientLight = compositor.CreateAmbientLight();

            ambientLight.Color = Colors.White;

            // Associate CompositionLight with XamlLight
            CompositionLight = ambientLight;

            // Add UIElement to the Light's Targets
            AmbLight.AddTargetElement(GetId(), newElement);
        }
Example #2
0
 protected override void OnDisconnected(UIElement oldElement)
 {
     // Dispose Light when it is removed from the tree
     AmbLight.RemoveTargetElement(GetId(), oldElement);
     CompositionLight.Dispose();
 }