Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private MetaContentEditor createEditor(MetaData data, MetaContentEditorShell shell)
        {
            switch (data.Type)
            {
            case MetaDataType.Title:
                shell.ViewToggle.Toggle(true);
                TitleEditor result = Instantiate(_titleEditorPrefab);
                result.Data = data as TitleData;
                return(result);

            case MetaDataType.Tags:
                shell.ViewToggle.Toggle(true);
                TagsEditor tagsEditor = Instantiate(_tagsEditorPrefab);
                tagsEditor.Data = data as TagsData;
                return(tagsEditor);

            case MetaDataType.CreationDate:
                shell.ViewToggle.Toggle(false);
                CreationDateEditor creationDateEditor = Instantiate(_creationDateEditor);
                creationDateEditor.Data = data as CreationDateData;
                return(creationDateEditor);

            case MetaDataType.LastChangedDate:
                shell.ViewToggle.Toggle(false);
                LastChangeDateEditor lastChangeDate = Instantiate(_lastChangeDateEditor);
                lastChangeDate.Data = data as LastChangeDateData;
                return(lastChangeDate);

            case MetaDataType.Comment:
                shell.ViewToggle.Toggle(true);
                CommentEditor commentEditor = Instantiate(_commentEditor);
                commentEditor.Data = data as CommentData;
                return(commentEditor);

            case MetaDataType.Description:
                shell.ViewToggle.Toggle(true);
                DescriptionEditor descriptionEditor = Instantiate(_descriptionEditor);
                descriptionEditor.Data = data as DescriptionData;
                return(descriptionEditor);

            case MetaDataType.PreviewImage:
                shell.ViewToggle.Toggle(true);
                PreviewImageEditor previewImageEditor = Instantiate(_previewImageEditor);
                previewImageEditor.Data = data as PreviewImageData;
                return(previewImageEditor);

            case MetaDataType.Author:
                shell.ViewToggle.Toggle(true);
                AuthorsEditor authorsEditor = Instantiate(_authorsEditor);
                authorsEditor.Data = data as AuthorData;
                return(authorsEditor);

            default:
                throw new NotImplementedException();
            }
        }
 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 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);
        }
 // 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);
 }
 public TextViewDelegate(ref CommentEditor editor, string hint, UIColor textColor)
 {
     _hint      = hint;
     _textColor = textColor;
     editorView = editor;
 }
 // sets the hint of the EditText
 void SetHint(CommentEditor view)
 {
     Control.Hint = view.Hint;
 }
Exemplo n.º 11
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     BindingContext = ViewModel;
     CommentEditor.Focus();
 }