public void RenderElement(RenderContext context) { if (String.IsNullOrEmpty(Accel.Key)) { return; } var cmd = GetBindingCommand(nameof(Command)); if (cmd == null) { return; } var ac = new TagBuilder("a2-accel-command"); ac.MergeAttribute("accel", Accel.GetKeyCode()); ac.MergeAttribute(":command", $"() => {cmd.GetCommand(context)}"); // FUNCTION!!! ac.Render(context); }
public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (CheckDisabledModel(context)) { return; } var input = new TagBuilder(TagName, null, IsInGrid); onRender?.Invoke(input); MergeAttributes(input, context); MergeDisabled(input, context); SetSize(input, nameof(TextBox)); if (Multiline) { MergeAttributeInt32(input, context, "rows", nameof(Rows), Rows); } if (Password) { input.MergeAttribute(":password", "true"); } if (Number) { input.MergeAttribute(":number", "true"); } if (AutoSize) { input.MergeAttribute(":auto-size", "true"); } if (UpdateTrigger != UpdateTrigger.Default) { input.MergeAttribute("update-trigger", UpdateTrigger.ToString().ToLowerInvariant()); } if (SpellCheck != null) { input.MergeAttribute(":spell-check", SpellCheck.Value.ToString().ToLowerInvariant()); } if (MaxHeight != null) { input.MergeAttribute("max-height", MaxHeight.Value); } if (Accel != null) { input.MergeAttribute("accel", Accel.GetKeyCode()); } var enterCmd = GetBindingCommand(nameof(EnterCommand)); if (enterCmd != null) { input.MergeAttribute(":enter-command", $"() => {enterCmd.GetCommand(context)}"); // FUNCTION!!! } if (ShowClear) { input.MergeAttribute(":has-clear", "true"); } MergeAlign(input, context, Align); MergeBindingAttributeString(input, context, "placeholder", nameof(Placeholder), Placeholder); MergeValue(input, context); input.RenderStart(context); RenderAddOns(context); input.RenderEnd(context); }