protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            switch (e.PropertyName)
            {
            case "Renderer":
                var content = GetChildAt(0);
                if (content == null)
                {
                    return;
                }

                if (_shadowView == null)
                {
                    _shadowView = new ShadowView(Context, content, Context.ToPixels(Element.CornerRadius));
                    _shadowView.UpdateShades(Element.Shades);

                    AddView(_shadowView, 0);
                }

                break;

            case nameof(Element.CornerRadius):
                _shadowView.UpdateCornerRadius(Context.ToPixels(Element.CornerRadius));
                break;

            case nameof(Element.Shades):
                _shadowView.UpdateShades(Element.Shades);
                break;
            }
        }
Example #2
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            switch (e.PropertyName)
            {
            case "Renderer":
                var content = GetChildAt(0);
                if (content == null)
                {
                    return;
                }

                if (!string.IsNullOrWhiteSpace(Element.StyleId))
                {
                    _tag += $" | {Element.StyleId}@{Element.InstanceNumber}";
                }

                if (_shadowView == null)
                {
                    _shadowView = new ShadowView(Context, content, Context.ToPixels(Element.CornerRadius));
                    _shadowView.UpdateShades(Element.Shades);

                    Element.WeakCollectionChanged += _shadowView.ShadesSourceCollectionChanged;

                    AddView(_shadowView, 0);

                    instanceCount++;
                    InternalLogger.Debug(_tag, () => $"Create ShadowView => {instanceCount} instances");
                }

                break;

            case nameof(Element.CornerRadius):
                _shadowView.UpdateCornerRadius(Context.ToPixels(Element.CornerRadius));
                break;

            case nameof(Element.Shades):
                _shadowView.UpdateShades(Element.Shades);
                break;
            }
        }