private void SetTextColor (CommentEditor view) { if (view.Text == view.Hint) SetHintColor (view); else Control.TextColor = UIColor.Black; }
private void SetFont(CommentEditor view) { UIFont uiFont; if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null) Control.Font = uiFont; else if (view.Font == Font.Default) Control.Font = UIFont.SystemFontOfSize(17f); }
// sets the font for the EditText void SetFont (CommentEditor view) { //FormattedString formattedString = base.Element.FormattedText ?? base.Element.Text; FormattedString formattedString = base.Element.Text; this.Control.TextFormatted = formattedString.ToAttributed (Font.Default, view.TextColor, this.Control); if (view.Font.FontFamily != null) this.Control.Typeface = Typeface.CreateFromAsset (Forms.Context.Assets, string.Format ("{0}.ttf", GetFontFamily(view.Font))); if (view.Font.FontSize > 0) this.Control.TextSize = (float)view.Font.FontSize; }
View CreateComment() { var comment = new CommentEditor { VerticalOptions = LayoutOptions.EndAndExpand, Font = Font.OfSize(Fonts.OpenSansLight, 14), Hint = "Add Comment", HeightRequest = 115 }; comment.SetBinding ( CommentEditor.TextProperty, "Comments", BindingMode.TwoWay ); var view = new StackLayout { Orientation = StackOrientation.Vertical, Children = { CreateDivider(), comment, CreateDivider() } }; return view; }
public TextViewDelegate(ref CommentEditor editor, string hint, UIColor textColor) { _hint = hint; _textColor = textColor; editorView = editor; }
// makes sure that the hint color is correct and // isn't the default color (black) private void SetHintColor (CommentEditor view) { Control.TextColor = UIColor.FromRGB (150, 150, 150); }
private void SetHint(CommentEditor view) { view.Text = view.Hint; SetHintColor (view); }
View CreateCommentBox () { var commentBox = new CommentEditor { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.EndAndExpand, Font = Font.OfSize(Fonts.OpenSansLight, 14), Hint = "Add Comment", WidthRequest = 275, HeightRequest = 115 }; commentBox.SetBinding ( CommentEditor.TextProperty, "ConferenceSurveyComments", BindingMode.OneWayToSource ); return commentBox; }
// sets the hint of the EditText void SetHint (CommentEditor view) { Control.Hint = view.Hint; }