public MvcHtmlString Label(string text, bool sronly = false, string @class = "")
        {
            var e = new BootstrapLabel();

            e.ScreenReaderOnly = sronly;
            e.InnerText        = text;
            e.Classes.Add(@class);

            return(Render(e));
        }
示例#2
0
        private static BootstrapLabel BeginLabelHelper(HtmlHelper html, ModelMetadata metadata, string htmlFieldName, string className, string labelText = null)
        {
            string resolvedLabelText = labelText ?? metadata.DisplayName ?? metadata.PropertyName ?? htmlFieldName.Split('.').Last();

            TagBuilder tag = new TagBuilder("label");

            tag.Attributes.Add("for", TagBuilder.CreateSanitizedId(html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName)));
            tag.Attributes.Add("class", className);
            tag.SetInnerText(resolvedLabelText);

            html.ViewContext.Writer.Write(tag.ToString(TagRenderMode.StartTag));

            BootstrapLabel theLabel = new BootstrapLabel(html.ViewContext, resolvedLabelText);

            return(theLabel);
        }
示例#3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            FindViewById <BootstrapLabel>(Resource.Id.example_blabel_change_color).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                BootstrapLabel view = v as BootstrapLabel;
                view?.ChangeBootstrapBrand();
            }));
            FindViewById <BootstrapLabel>(Resource.Id.example_blabel_change_heading).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                var lblChangeHeading = v as BootstrapLabel;

                lblChangeHeading?.ChangeBootstrapHeading();
            }));
            FindViewById <BootstrapLabel>(Resource.Id.example_blabel_change_rounded).SetOnClickListener(new Utils.ViewOnClick(v =>
            {
                var lblChangeRounded     = v as BootstrapLabel;
                lblChangeRounded.Rounded = !lblChangeRounded.Rounded;
            }));
        }
 public MvcHtmlString Label(BootstrapLabel label)
 {
     return(Render(label));
 }