Ejemplo n.º 1
0
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            if (viewStyle is SwitchStyle switchStyle)
            {
                if (Extension is SwitchExtension extension)
                {
                    track.Unparent();
                    thumb.Unparent();
                    track = extension.OnCreateTrack(this, track);
                    thumb = extension.OnCreateThumb(this, thumb);
                    track.Add(thumb);
                }

                if (switchStyle.Track != null)
                {
                    Track.ApplyStyle(switchStyle.Track);
                }

                if (switchStyle.Thumb != null)
                {
                    Thumb.ApplyStyle(switchStyle.Thumb);
                }
            }

            base.ApplyStyle(viewStyle);
        }
Ejemplo n.º 2
0
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            base.ApplyStyle(viewStyle);

            SwitchStyle swStyle = viewStyle as SwitchStyle;

            if (null != swStyle)
            {
                if (swStyle.Track != null)
                {
                    Track.ApplyStyle(swStyle.Track);
                }

                if (swStyle.Thumb != null)
                {
                    Thumb.ApplyStyle(swStyle.Thumb);
                }
            }
        }