本文整理汇总了C#中Microsoft.AspNet.Razor.TagHelpers.TagHelperOutput.AddCssClass方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperOutput.AddCssClass方法的具体用法?C# TagHelperOutput.AddCssClass怎么用?C# TagHelperOutput.AddCssClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Razor.TagHelpers.TagHelperOutput
的用法示例。
在下文中一共展示了TagHelperOutput.AddCssClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessNonCheckControl
private void ProcessNonCheckControl(TagHelperOutput output) {
output.AddCssClass("form-control");
if (!string.IsNullOrEmpty(PostAddonText) || !string.IsNullOrEmpty(PreAddonText)) {
if ((Size ?? BootstrapTagHelpers.Size.Default) != BootstrapTagHelpers.Size.Default) {
Size size = Size == BootstrapTagHelpers.Size.Large
? BootstrapTagHelpers.Size.Large
: BootstrapTagHelpers.Size.Small;
output.PreElement.PrependHtml($"<div class=\"input-group input-group-{size.GetDescription()}\">");
}
else
output.PreElement.PrependHtml("<div class=\"input-group\">");
if (!string.IsNullOrEmpty(PreAddonText))
output.PreElement.AppendHtml(AddonTagHelper.GenerateAddon(PreAddonText));
if (!string.IsNullOrEmpty(PostAddonText))
output.PostElement.AppendHtml(AddonTagHelper.GenerateAddon(PostAddonText));
output.PostElement.AppendHtml("</div>");
}
else if (Size != null && Size != BootstrapTagHelpers.Size.Default)
output.AddCssClass("input-" + Size.Value.GetDescription());
if (!string.IsNullOrEmpty(HelpText))
if (InputGroupContext != null)
InputGroupContext.Output.PostElement.PrependHtml(HelpBlockTagHelper.GenerateHelpBlock(HelpText));
else
output.PostElement.AppendHtml(HelpBlockTagHelper.GenerateHelpBlock(HelpText));
if (InputGroupContext==null)
if (FormGroupContext != null)
FormGroupContext.WrapInDivForHorizontalForm(output, !string.IsNullOrEmpty(Label));
else if (FormContext != null)
FormContext.WrapInDivForHorizontalForm(output, !string.IsNullOrEmpty(Label));
if (!string.IsNullOrEmpty(Label))
if (InputGroupContext == null)
output.PreElement.Prepend(LabelTagHelper.GenerateLabel(Label, Id, FormContext));
else
InputGroupContext.Output.PreElement.Prepend(LabelTagHelper.GenerateLabel(Label, Id,
FormContext));
if (FormGroupContext != null && FormGroupContext.HasFeedback &&
FormGroupContext.ValidationContext != null) {
string cssClass;
string srText;
switch (FormGroupContext.ValidationContext.Value) {
case ValidationContext.Success:
cssClass = "ok";
srText = Ressources.ValidationSuccess;
break;
case ValidationContext.Warning:
cssClass = "warning-sign";
srText = Ressources.ValidationWarning;
break;
case ValidationContext.Error:
cssClass = "remove";
srText = Ressources.ValidationError;
break;
default:
throw new ArgumentOutOfRangeException();
}
output.PostElement.PrependHtml(
$"<span class=\"glyphicon glyphicon-{cssClass} form-control-feedback\" aria-hidden=\"true\"></span>");
output.PostElement.PrependHtml($"<span class=\"sr-only\">({srText})</span>");
}
}
示例2: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
if (Format == null)
Format = Configuration.ResponsiveEmbedFormat;
output.TagName = "div";
output.AddCssClass("embed-responsive");
output.AddCssClass("embed-responsive-" + Format.Value.GetDescription());
}
示例3: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
context.SetButtonGroupContext(this);
output.Attributes.Add("role", "group");
if (context.HasInputGroupContext())
{
Size = BootstrapTagHelpers.Size.Default;
if (!context.HasInputGroupAddonContext())
{
output.TagName = "span";
output.AddCssClass("input-group-btn");
}
context.RemoveInputGroupContext();
}
else {
output.TagName = "div";
if (Vertical)
output.AddCssClass("btn-group-vertical");
else
output.AddCssClass("btn-group");
if (Size.HasValue)
output.AddCssClass("btn-group-" + Size.Value.GetDescription());
if (Justified)
output.AddCssClass("btn-group-justified");
}
}
示例4: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "ul";
output.AddCssClass("nav");
output.AddCssClass("nav-tabs");
if (Justified)
output.AddCssClass("nav-justified");
context.SetNavContext(this);
}
示例5: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
output.AddCssClass("panel");
output.AddCssClass("panel-" + Context.ToString().ToLower());
if (!string.IsNullOrEmpty(Heading))
output.PreContent.PrependHtml($"<div class=\"panel-heading\">{Heading}</div>");
if (!string.IsNullOrEmpty(Footer))
output.PostContent.AppendHtml($"<div class=\"panel-footer\">{Footer}</div>");
}
示例6: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
output.AddCssClass("form-group");
if (ValidationContext.HasValue)
output.AddCssClass("has-" + ValidationContext.Value.ToString().ToLower());
if (HasFeedback)
output.AddCssClass("has-feedback");
if (Size != null && Size != SimpleSize.Default)
output.AddCssClass("form-group-" + Size.Value.GetDescription());
}
示例7: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
if (Rounded)
output.AddCssClass("img-rounded");
if (Circle)
output.AddCssClass("img-circle");
if (Thumbnail)
output.AddCssClass("img-thumbnail");
if (Responsive)
output.AddCssClass("img-responsive");
}
示例8: RenderOutput
protected virtual void RenderOutput(TagHelperOutput output) {
output.TagName = GetTagName();
output.AddCssClass("list-group-item");
if (!string.IsNullOrEmpty(BadgeText))
output.PreContent.PrependHtml($"<span class=\"badge\">{BadgeText}</span>");
if (Context != null)
output.AddCssClass("list-group-item-" + Context.ToString().ToLower());
if (Active)
output.AddCssClass("active");
if (Disabled)
output.AddCssClass("disabled");
}
示例9: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.AddCssClass("form-control");
if (FormGroupContext != null)
FormGroupContext.WrapInDivForHorizontalForm(output, !string.IsNullOrEmpty(Label));
else if (FormContext != null)
FormContext.WrapInDivForHorizontalForm(output, !string.IsNullOrEmpty(Label));
if (!string.IsNullOrEmpty(Label))
output.PreElement.Prepend(LabelTagHelper.GenerateLabel(Label, FormContext));
if (!string.IsNullOrEmpty(HelpText))
output.PostElement.PrependHtml(HelpBlockTagHelper.GenerateHelpBlock(HelpText));
if (Size != null && Size != BootstrapTagHelpers.Size.Default)
output.AddCssClass("input-" + Size.Value.GetDescription());
}
示例10: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "li";
output.Attributes.Add("role", "presentation");
if (Disabled) {
output.AddCssClass("disabled");
output.PreContent.PrependHtml($"<a data-href=\"{Href}\">");
}
else
output.PreContent.PrependHtml($"<a href=\"{Href}\">");
output.PostContent.AppendHtml("</a>");
if (Active)
output.AddCssClass("active");
}
示例11: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
if (FormContext?.Horizontal ?? true) {
if ((WidthLg ?? 0) > 0) {
output.AddCssClass("col-lg-" + WidthLg);
if (SetOffset ?? false)
output.AddCssClass("col-lg-offset-" + (12 - WidthLg));
}
if ((WidthMd ?? 0) > 0) {
output.AddCssClass("col-md-" + WidthMd);
if (SetOffset ?? false)
output.AddCssClass("col-md-offset-" + (12 - WidthMd));
}
if ((WidthSm ?? 0) > 0) {
output.AddCssClass("col-sm-" + WidthSm);
if (SetOffset ?? false)
output.AddCssClass("col-sm-offset-" + (12 - WidthSm));
}
if ((WidthXs ?? 0) > 0) {
output.AddCssClass("col-xs-" + WidthXs);
if (SetOffset ?? false)
output.AddCssClass("col-xs-offset-" + (12 - WidthXs));
}
}
}
示例12: BootstrapProcessAsync
protected override async Task BootstrapProcessAsync(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
output.AddCssClass("alert");
output.AddCssClass("alert-" + Context.ToString().ToLower());
output.Attributes.Add("role", "attribute");
if (Dismissable)
output.PreContent.SetHtmlContent(
$"<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"{Ressources.CloseIconText}\"><span aria-hidden=\"true\">×</span></button>");
if (!DisableLinkStyling) {
var content = await output.GetChildContentAsync(true);
output.Content.SetHtmlContent(Regex.Replace(content.GetContent(), "<a( [^>]+)?>", AddLinkStyle));
}
}
示例13: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
if (HiddenXs)
output.AddCssClass("hidden-xs");
if (HiddenSm)
output.AddCssClass("hidden-sm");
if (HiddenMd)
output.AddCssClass("hidden-md");
if (HiddenLg)
output.AddCssClass("hidden-lg");
if (HiddenPrint)
output.AddCssClass("hidden-print");
if (SrOnly || SrOnlyFocusable)
output.AddCssClass("sr-only");
if (SrOnlyFocusable)
output.AddCssClass("sr-only-focusable");
if (VisibleXs != null)
output.AddCssClass("visible-xs-" + VisibleXs.Value.GetDescription());
if (VisibleSm != null)
output.AddCssClass("visible-sm-" + VisibleSm.Value.GetDescription());
if (VisibleMd != null)
output.AddCssClass("visible-md-" + VisibleMd.Value.GetDescription());
if (VisibleLg != null)
output.AddCssClass("visible-lg-" + VisibleLg.Value.GetDescription());
if (VisiblePrint != null)
output.AddCssClass("visible-print-" + VisiblePrint.Value.GetDescription());
}
示例14: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
output.AddCssClass("jumbotron");
if (FullWidth) {
output.PreContent.SetHtmlContent(@"<div class=""container"">");
output.PostContent.SetHtmlContent(@"</div>");
}
}
示例15: BootstrapProcessAsync
protected override async Task BootstrapProcessAsync(TagHelperContext context, TagHelperOutput output) {
ChildDetectionMode = true;
await output.GetChildContentAsync();
ChildDetectionMode = false;
output.TagName = RenderAsDiv ? "div" : "ul";
output.AddCssClass("list-group");
await output.GetChildContentAsync(false);
}