Exemplo n.º 1
0
        /// <summary>
        /// Adds an existing text container (UILabel, UITextView, UITextField) to the StyleManager and styles it
        /// </summary>
        /// <param name="target">Target text container</param>
        /// <param name="styleID">The CSS selector name for the style</param>
        /// <param name="text">Text to display. Plain or with html tags</param>
        /// <param name="customTags">A list of custom <c>CSSTagStyle</c> instances that set the styling for the html</param>
        /// <param name="useExistingStyles">Existing CSS styles willl be used If set to <c>true</c></param>
        /// <param name="encoding">String encoding type</param>
        public void Add(object target, string styleID, string text = "", List <CssTagStyle> customTags = null, bool useExistingStyles = true, Encoding encoding = null, bool enableHtmlEditing = false)
        {
            var viewStyle = new ViewStyle(_instance, (TextView)target, styleID, text, true)
            {
                StyleID           = styleID,
                CustomTags        = customTags,
                EnableHtmlEditing = enableHtmlEditing
            };

            _views.Add(target, viewStyle);
            viewStyle.UpdateText();
            viewStyle.UpdateDisplay();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds an existing text container (UILabel, UITextView, UITextField) to the StyleManager and styles it
        /// </summary>
        /// <param name="target">Target text container</param>
        /// <param name="styleID">The CSS selector name for the style</param>
        /// <param name="text">Text to display. Plain or with html tags</param>
        /// <param name="customTags">A list of custom <c>CSSTagStyle</c> instances that set the styling for the html</param>
        /// <param name="useExistingStyles">Existing CSS styles willl be used If set to <c>true</c></param>
        /// <param name="encoding">String encoding type</param>
        public void Add(object target, string styleID, string text = "", List <CssTagStyle> customTags = null, bool useExistingStyles = true, bool enableHtmlEditing = false)
        {
            // Set the base style for the field
            _instance.SetBaseStyle(styleID, ref customTags);

            var viewStyle = new ViewStyle(_instance, (UIView)target, styleID, text, true)
            {
                CustomTags        = customTags,
                EnableHtmlEditing = enableHtmlEditing
            };

            _views.Add(target, viewStyle);
            viewStyle.UpdateText();
            viewStyle.UpdateDisplay();
        }