Exemplo n.º 1
0
                public void SetStyleValue(EditStyling.Style style, object value)
                {
                    switch (style)
                    {
                    case EditStyling.Style.FontName:
                    {
                        string fontName = value as string;
                        PlatformLabel.Editable_SetFontName(fontName);

                        break;
                    }

                    case EditStyling.Style.FontSize:
                    {
                        float fontSize = (float)value;
                        PlatformLabel.Editable_SetFontSize(fontSize);

                        break;
                    }

                    case EditStyling.Style.Underline:
                    {
                        bool enableUnderline = (bool)value;

                        if (enableUnderline)
                        {
                            PlatformLabel.Editable_AddUnderline( );
                        }
                        else
                        {
                            PlatformLabel.Editable_RemoveUnderline( );
                        }

                        break;
                    }

                    case EditStyling.Style.BoldParagraph:
                    {
                        // for bolding the paragraph, forward this to the parent
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        // for underlining the paragraph, forward this to the parent
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }
                    }

                    // first, reset our dimensions and call sizeToFit, which will
                    // fully recalculate our bounds (since our font name / size may have changed.)
                    PlatformLabel.Bounds = new RectangleF(0, 0, 0, 0);
                    PlatformLabel.SizeToFit( );

                    // now notify our parent so it can update its layout with our new size
                    ParentControl.HandleChildStyleChanged(style, this);
                }