Пример #1
0
        public ChatBackgroundPresenter()
        {
            _parallaxEffect               = new BackgroundParallaxEffect();
            _imageBackground              = new Rectangle();
            _colorBackground              = new Rectangle();
            _colorBackground.SizeChanged += OnSizeChanged;

            Children.Add(_colorBackground);
            Children.Add(_imageBackground);

            RegisterPropertyChangedCallback(OpacityProperty, OnOpacityChanged);



            _motionVisual = ElementCompositionPreview.GetElementVisual(_colorBackground);
            _compositor   = _motionVisual.Compositor;

            ElementCompositionPreview.GetElementVisual(this).Clip = _compositor.CreateInsetClip();
        }
Пример #2
0
        private async void InitializeMotion()
        {
            _parallaxEffect = new BackgroundParallaxEffect();

            Motion.Visibility = (await _parallaxEffect.IsSupportedAsync()) ? Visibility.Visible : Visibility.Collapsed;
        }