Class RenderMudAutocompleteAttribute
This class is an attribute that, when applied to a string property, causes the form generator to render the property as a MudBlazor.MudAutocomplete`1 component.
Inheritance
Inherited Members
Namespace: CG.Blazor.Forms.Attributes
Assembly: CG.Blazor.Forms._MudBlazor.dll
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class RenderMudAutocompleteAttribute : MudBlazorAttribute
Remarks
This attribute is only valid when placed on a property of type: string.
When configured to do so, this attribute causes the form generator to wire up a search function for the auto-complete behavior. In order to configure that behavior, the SearchFunc parameter should be set to the name of a method on the model. Then, at form generation time, the form generator will locate that method and wire up a callback.
Examples
Here is an example of decorating a model property to render a MudBlazor.MudAutocomplete`1:
using CG.Blazor.Forms.Attributes;
class MyModel
{
[RenderMudAutocomplete(SearchFunc = "Search1")]
public string MyProperty { get;set; }
public async Task{IEnumerable{string}} Search1(string value)
{
// TODO : write search code here.
}
}
Constructors
RenderMudAutocompleteAttribute()
This constructor creates a new instance of the RenderMudAutocompleteAttribute class.
Declaration
public RenderMudAutocompleteAttribute()
Properties
Adornment
This property contains the Start or End Adornment if not set to None.
Declaration
public Adornment Adornment { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Adornment |
AdornmentColor
This property contains the color of the adornment if used. It supports the theme colors.
Declaration
public Color AdornmentColor { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Color |
AdornmentIcon
This property contains the Icon that will be used if Adornment is set to Start or End.
Declaration
public string AdornmentIcon { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AdornmentText
This property contains text that will be used if Adornment is set to Start or End, the Text overrides Icon.
Declaration
public string AdornmentText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AutoFocus
This property indicates the input will focus automatically, when true.
Declaration
public bool AutoFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Clearable
This property indicates whether to show the clear button, or not.
Declaration
public bool Clearable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CloseIcon
This property contains the Close Autocomplete Icon.
Declaration
public string CloseIcon { get; set; }
Property Value
Type | Description |
---|---|
System.String |
CoerceText
This property appears on the drop-down close override Text with selected Value. This makes it clear to the user which list value is currently selected and disallows incomplete values in Text.
Declaration
public bool CoerceText { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CoerceValue
This property indicates whether user input will be coerced, or not.
Declaration
public bool CoerceValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
DebounceInterval
This property contains an interval to be awaited, in milliseconds, before changing the Text value
Declaration
public double DebounceInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Dense
This property indicates whether compact vertical padding will be applied to all Autocomplete items, or not.
Declaration
public bool Dense { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Direction
This property indicates the direction the Autocomplete menu should use, when opening.
Declaration
public Direction Direction { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Direction |
DisableUnderLine
This property indicates whether the input will have an underline, or not.
Declaration
public bool DisableUnderLine { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Format
This property contains the conversion format parameter for ToString(), can be used for formatting primitive types, DateTimes and TimeSpans
Declaration
public string Format { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FullWidth
This property indicates whether the input will take up the full width of its container, or not.
Declaration
public bool FullWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IconSize
This property indicates the icon size.
Declaration
public Size IconSize { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Size |
Immediate
This property indicates whether the the input will update the Value immediately on typing. If false, the Value is updated only on Enter.
Declaration
public bool Immediate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
InputMode
This property hints at the type of data that might be entered by the user while editing the input
Declaration
public InputMode InputMode { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.InputMode |
Label
This property contains the label text will be displayed in the input, and scaled down at the top if the input has value.
Declaration
public string Label { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Lines
This property contains the number of lines that the input will display.
Declaration
public int Lines { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Margin
This property indicates how much to change the vertical spacing.
Declaration
public Margin Margin { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Margin |
MaxItems
This property indicates how may items to display.
Declaration
public int? MaxItems { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
MinCharacters
This property indicates the minimal number of character required to initiate a search.
Declaration
public int MinCharacters { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
OffsetX
This property indicates whether the Autocomplete menu opens before or after the input (left/right).
Declaration
public bool OffsetX { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
OffsetY
This property indicates whether the Autocomplete menu opens before or after the input (top/bottom).
Declaration
public bool OffsetY { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
OpenIcon
This property contains the open icon.
Declaration
public string OpenIcon { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Pattern
This property contains a regular expression which the input's value must match in order for the value to pass constraint validation. It must be a valid JavaScript regular expression Not Supported in multline input
Declaration
public string Pattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Placeholder
This property contains the short hint displayed in the input before the user enters a value.
Declaration
public string Placeholder { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ReadOnly
This property indicates whether the input will be read-only, or not.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ResetValueOnEmptyText
This property indicates whether the control will reset Value if user deletes the text
Declaration
public bool ResetValueOnEmptyText { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SearchFunc
This property contains the name of an optional search function, on either the top-level view-model, or the the associated model.
Declaration
public string SearchFunc { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The method should have this signature: Task{IEnumerable{string}} Method(string value)
SelectValueOnTab
This property indicates whether the currently selected item from the drop-down (if it is open) will be selected on a tab, or not.
Declaration
public bool SelectValueOnTab { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Variant
This property contains the variant to use with the control.
Declaration
public Variant Variant { get; set; }
Property Value
Type | Description |
---|---|
MudBlazor.Variant |
Methods
Generate(RenderTreeBuilder, Int32, IHandleEvent, Stack<Object>, PropertyInfo, ILogger<IFormGenerator>)
Declaration
public override int Generate(RenderTreeBuilder builder, int index, IHandleEvent eventTarget, Stack<object> path, PropertyInfo prop, ILogger<IFormGenerator> logger)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | builder | |
System.Int32 | index | |
Microsoft.AspNetCore.Components.IHandleEvent | eventTarget | |
System.Collections.Generic.Stack<System.Object> | path | |
System.Reflection.PropertyInfo | prop | |
Microsoft.Extensions.Logging.ILogger<CG.Blazor.Forms.Services.IFormGenerator> | logger |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
ToAttributes()
Declaration
public override IDictionary<string, object> ToAttributes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |