Example #1
0
        private void SetDecoratorTemplatedParentBindings()
        {
            // The attached dependency properties are a little trickier.
            // Each of them is set on the TemplatedParent. As a result, we must bind to that
            // element.
            var blurRadiusBinding = CreateTemplatedParentBinding(ThemeShadow.BlurRadiusProperty);
            var offsetXBinding    = CreateTemplatedParentBinding(ThemeShadow.OffsetXProperty);
            var offsetYBinding    = CreateTemplatedParentBinding(ThemeShadow.OffsetYProperty);

            ShadowDecorator.SetBinding(DropShadowDecorator.BlurRadiusProperty, blurRadiusBinding);
            ShadowDecorator.SetBinding(DropShadowDecorator.OffsetXProperty, offsetXBinding);
            ShadowDecorator.SetBinding(DropShadowDecorator.OffsetYProperty, offsetYBinding);
        }
Example #2
0
        private void SetDecoratorThemeShadowBindings()
        {
            // The non-attached dependency properties of the ThemeShadow can be bound
            // directly to the DropShadowDecorator.
            var renderingBiasBinding = CreateThemeShadowBinding(ThemeShadow.RenderingBiasProperty);
            var shadowColorBinding   = CreateThemeShadowBinding(ThemeShadow.ShadowColorProperty);
            var shadowOpacityBinding = CreateThemeShadowBinding(ThemeShadow.ShadowOpacityProperty);
            var shadowEnabledBinding = CreateThemeShadowBinding(ThemeShadow.IsShadowEnabledProperty);

            ShadowDecorator.SetBinding(DropShadowDecorator.RenderingBiasProperty, renderingBiasBinding);
            ShadowDecorator.SetBinding(DropShadowDecorator.ShadowColorProperty, shadowColorBinding);
            ShadowDecorator.SetBinding(DropShadowDecorator.ShadowOpacityProperty, shadowOpacityBinding);
            ShadowDecorator.SetBinding(DropShadowDecorator.IsShadowEnabledProperty, shadowEnabledBinding);
        }