Ejemplo n.º 1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            if (_view == null)
            {
                _view = (FormsTextView)CreateNativeControl();
                _labelTextColorDefault        = _view.TextColors;
                _lineSpacingMultiplierDefault = _view.LineSpacingMultiplier;
                _lineSpacingExtraDefault      = _view.LineSpacingExtra;
                SetNativeControl(_view);
            }

            if (e.OldElement == null)
            {
                UpdateText();
                UpdateLineBreakMode();
                UpdateCharacterSpacing();
                UpdateLineHeight();
                UpdateGravity();
                UpdateMaxLines();
                UpdateFlowDirection();
            }
            else
            {
                UpdateText();
                if (e.OldElement.LineBreakMode != e.NewElement.LineBreakMode)
                {
                    UpdateLineBreakMode();
                }
                if (e.OldElement.HorizontalTextAlignment != e.NewElement.HorizontalTextAlignment || e.OldElement.VerticalTextAlignment != e.NewElement.VerticalTextAlignment)
                {
                    UpdateGravity();
                }
                if (e.OldElement.MaxLines != e.NewElement.MaxLines)
                {
                    UpdateMaxLines();
                }
                if (e.OldElement.CharacterSpacing != e.NewElement.CharacterSpacing)
                {
                    UpdateCharacterSpacing();
                }
                if (e.OldElement.FlowDirection != e.NewElement.FlowDirection)
                {
                    UpdateFlowDirection();
                }
            }
            UpdateTextDecorations();
            UpdatePadding();
            _motionEventHelper.UpdateElement(e.NewElement);
        }