private void UpdateBrush()

in SamplesCommon/SamplesCommon/CompositionImage.cs [252:280]


        private void UpdateBrush()
        {
            _surfaceBrush.Surface = _surface == null ? null : _surface.Surface;
            _surfaceBrush.Stretch = _stretchMode;

            if (_sprite != null)
            {
                // If the active brush is not set, use the surface brush
                if (_brush != null)
                {
                    if (_brush is CompositionEffectBrush)
                    {
                        //
                        // If there is an EffectBrush set, it must supply ImageSource reference parameter for setitng
                        // the Image content.
                        //

                        ((CompositionEffectBrush)_brush).SetSourceParameter("ImageSource", _surfaceBrush);
                    }

                    // Update the sprite to use the brush
                    _sprite.Brush = _brush;
                }
                else
                {
                    _sprite.Brush = _surfaceBrush;
                }
            }
        }