protected override IBound Apply(IStyleSheet stylesheet, IBound styleBound, IBound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.Helper; // text-format _textFormat = style.TextFormat(this); SetText(); // background color, background image, borders using (var background = stylesheet.Background(this, styleBound)) SetBackground(background); // font stylesheet.SetFontSettings(this, _view, styleBound.Height); // text color _textColor = style.Color(this).ToColorOrTransparent(); _view.SetTextColor(_textColor); //selected color _selectedColor = style.SelectedColor(this).ToNullableColor(); //selected background _selectionBehaviour = new SelectionBehaviour(style.SelectedBackground(this).ToNullableColor(), this, stylesheet); // word wrap _singleLine = style.WhiteSpace(this) == WhiteSpaceKind.Nowrap; if (_singleLine) { _view.SetSingleLine(); } // text align TextAlignValues align = style.TextAlign(this, DefaultAlignValues); ApplyTextAlign(align); if (_singleLine) { _view.Ellipsize = align == TextAlignValues.Right ? TextUtils.TruncateAt.Start : TextUtils.TruncateAt.End; } // text padding int pl = style.PaddingLeft(this, styleBound.Width).Round(); int pt = style.PaddingTop(this, styleBound.Height).Round(); int pr = style.PaddingRight(this, styleBound.Width).Round(); int pb = style.PaddingBottom(this, styleBound.Height).Round(); _view.SetPadding(pl, pt, pr, pb); return(SizeToContent(styleBound, maxBound, style)); }
protected override IBound Apply(IStyleSheet stylesheet, IBound styleBound, IBound maxBound) { base.Apply(stylesheet, styleBound, maxBound); var style = stylesheet.Helper; // background color, background image, borders using (var background = stylesheet.Background(this, styleBound)) SetBackground(background); // selected color _selectionBehaviour = new SelectionBehaviour(style.SelectedColor(this).ToNullableColor(), this, stylesheet); IBound bound = GetBoundByBackgroud(styleBound, maxBound); return(LayoutChildren(stylesheet, bound, maxBound)); }