Class MudSelect<T>
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
public class MudSelect<T> : MudBaseInput<T>, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IFormComponent, IDisposable
Type Parameters
T
- Inheritance
-
MudBaseInput<T>MudSelect<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
MudSelect()
public MudSelect()
Fields
_items
protected List<MudSelectItem<T>> _items
Field Value
- List<MudSelectItem<T>>
_shadowLookup
protected Dictionary<T, MudSelectItem<T>> _shadowLookup
Field Value
- Dictionary<T, MudSelectItem<T>>
_valueLookup
protected Dictionary<T, MudSelectItem<T>> _valueLookup
Field Value
- Dictionary<T, MudSelectItem<T>>
Properties
AnchorOrigin
Set the anchor origin point to determen where the popover will open from.
[Parameter]
[Category("List appearance")]
public Origin AnchorOrigin { get; set; }
Property Value
CanRenderValue
Returns whether or not the Value can be found in items. If not, the Select will display it as a string.
protected bool CanRenderValue { get; }
Property Value
CheckedIcon
Custom checked icon.
[Parameter]
[Category("List appearance")]
public string CheckedIcon { get; set; }
Property Value
ChildContent
Add the MudSelectItems here
[Parameter]
[Category("List behavior")]
public RenderFragment ChildContent { get; set; }
Property Value
Classname
protected string Classname { get; }
Property Value
ClearIcon
Custom clear icon when Clearable is enabled.
[Parameter]
[Category("Appearance")]
public string ClearIcon { get; set; }
Property Value
Clearable
Show clear button.
[Parameter]
[Category("Behavior")]
public bool Clearable { get; set; }
Property Value
CloseIcon
The Close Select Icon
[Parameter]
[Category("Appearance")]
public string CloseIcon { get; set; }
Property Value
Comparer
The Comparer to use for comparing selected values internally.
[Parameter]
[Category("Behavior")]
public IEqualityComparer<T> Comparer { get; set; }
Property Value
Delimiter
Parameter to define the delimited string separator.
[Parameter]
[Category("Behavior")]
public string Delimiter { get; set; }
Property Value
Dense
If true, compact vertical padding will be applied to all Select items.
[Parameter]
[Category("List appearance")]
public bool Dense { get; set; }
Property Value
IndeterminateIcon
Custom indeterminate icon.
[Parameter]
[Category("List appearance")]
public string IndeterminateIcon { get; set; }
Property Value
InputClass
Input's classnames, seperated by space.
[Category("Appearance")]
[Parameter]
public string InputClass { get; set; }
Property Value
InputClassname
protected string InputClassname { get; }
Property Value
IsValueInList
protected bool IsValueInList { get; }
Property Value
Items
The collection of items within this select
public IReadOnlyList<MudSelectItem<T>> Items { get; }
Property Value
ListClass
User class names for the internal list, separated by space
[Parameter]
[Category("List appearance")]
public string ListClass { get; set; }
Property Value
LockScroll
If true, prevent scrolling while dropdown is open.
[Parameter]
[Category("List behavior")]
public bool LockScroll { get; set; }
Property Value
MaxHeight
Sets the maxheight the Select can have when open.
[Parameter]
[Category("List appearance")]
public int MaxHeight { get; set; }
Property Value
MultiSelection
If true, multiple values can be selected via checkboxes which are automatically shown in the dropdown
[Parameter]
[Category("List behavior")]
public bool MultiSelection { get; set; }
Property Value
MultiSelectionTextFunc
Function to define a customized multiselection text.
[Parameter]
[Category("Behavior")]
public Func<List<string>, string> MultiSelectionTextFunc { get; set; }
Property Value
OnClearButtonClick
Button click event for clear button. Called after text and value has been cleared.
[Parameter]
public EventCallback<MouseEventArgs> OnClearButtonClick { get; set; }
Property Value
OnClose
Fired when dropdown closes.
[Category("Behavior")]
[Parameter]
public EventCallback OnClose { get; set; }
Property Value
OnOpen
Fired when dropdown opens.
[Category("Behavior")]
[Parameter]
public EventCallback OnOpen { get; set; }
Property Value
OpenIcon
The Open Select Icon
[Parameter]
[Category("Appearance")]
public string OpenIcon { get; set; }
Property Value
OuterClass
The outer div's classnames, seperated by space.
[Category("Appearance")]
[Parameter]
public string OuterClass { get; set; }
Property Value
OuterClassname
protected string OuterClassname { get; }
Property Value
PopoverClass
User class names for the popover, separated by space
[Parameter]
[Category("List appearance")]
public string PopoverClass { get; set; }
Property Value
SelectAll
If set to true and the MultiSelection option is set to true, a "select all" checkbox is added at the top of the list of items.
[Parameter]
[Category("List behavior")]
public bool SelectAll { get; set; }
Property Value
SelectAllCheckBoxIcon
The checkbox icon reflects the select all option's state
protected string SelectAllCheckBoxIcon { get; }
Property Value
SelectAllText
Define the text of the Select All option.
[Parameter]
[Category("List appearance")]
public string SelectAllText { get; set; }
Property Value
SelectedValues
Set of selected values. If MultiSelection is false it will only ever contain a single value. This property is two-way bindable.
[Parameter]
[Category("Data")]
public IEnumerable<T> SelectedValues { get; set; }
Property Value
- IEnumerable<T>
SelectedValuesChanged
Fires when SelectedValues changes.
[Parameter]
public EventCallback<IEnumerable<T>> SelectedValuesChanged { get; set; }
Property Value
Strict
If true, the Select's input will not show any values that are not defined in the dropdown. This can be useful if Value is bound to a variable which is initialized to a value which is not in the list and you want the Select to show the label / placeholder instead.
[Parameter]
[Category("Behavior")]
public bool Strict { get; set; }
Property Value
ToStringFunc
Defines how values are displayed in the drop-down list
[Parameter]
[Category("List behavior")]
public Func<T, string> ToStringFunc { get; set; }
Property Value
TransformOrigin
Sets the transform origin point for the popover.
[Parameter]
[Category("List appearance")]
public Origin TransformOrigin { get; set; }
Property Value
UncheckedIcon
Custom unchecked icon.
[Parameter]
[Category("List appearance")]
public string UncheckedIcon { get; set; }
Property Value
_currentIcon
public string _currentIcon { get; set; }
Property Value
Methods
BlurAsync()
public override ValueTask BlurAsync()
Returns
BuildRenderTree(RenderTreeBuilder)
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
RenderTreeBuilder
CheckGenericTypeMatch(object)
public void CheckGenericTypeMatch(object select_item)
Parameters
select_item
object
Clear()
Clear the selection
public Task Clear()
Returns
CloseMenu(bool)
public Task CloseMenu(bool focusAgain = true)
Parameters
focusAgain
bool
Returns
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
FocusAsync()
public override ValueTask FocusAsync()
Returns
ForceUpdate()
public override Task ForceUpdate()
Returns
GetSelectedValuePresenter()
protected RenderFragment GetSelectedValuePresenter()
Returns
HasValue(T)
Fixes issue #4328 Returns true when MultiSelection is true and it has selected values(Since Value property is not used when MultiSelection=true
protected override bool HasValue(T value)
Parameters
value
T
Returns
- bool
True when component has a value
OnAfterRender(bool)
protected override void OnAfterRender(bool firstRender)
Parameters
firstRender
bool
OnAfterRenderAsync(bool)
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRender
bool
Returns
OnInitialized()
protected override void OnInitialized()
OnParametersSet()
protected override void OnParametersSet()
OpenMenu()
public Task OpenMenu()
Returns
RegisterShadowItem(MudSelectItem<T>)
public void RegisterShadowItem(MudSelectItem<T> item)
Parameters
item
MudSelectItem<T>
SelectAsync()
public override ValueTask SelectAsync()
Returns
SelectClearButtonClickHandlerAsync(MouseEventArgs)
Extra handler for clearing selection.
protected ValueTask SelectClearButtonClickHandlerAsync(MouseEventArgs e)
Parameters
Returns
SelectOption(int)
public Task SelectOption(int index)
Parameters
index
int
Returns
SelectOption(object)
public Task SelectOption(object obj)
Parameters
obj
object
Returns
SelectRangeAsync(int, int)
public override ValueTask SelectRangeAsync(int pos1, int pos2)
Parameters
Returns
SetCustomizedTextAsync(string, bool, List<string>, Func<List<string>, string>)
protected Task SetCustomizedTextAsync(string text, bool updateValue = true, List<string> selectedConvertedValues = null, Func<List<string>, string> multiSelectionTextFunc = null)
Parameters
text
stringupdateValue
boolselectedConvertedValues
List<string>multiSelectionTextFunc
Func<List<string>, string>
Returns
ToggleMenu()
public Task ToggleMenu()
Returns
UnregisterShadowItem(MudSelectItem<T>)
public void UnregisterShadowItem(MudSelectItem<T> item)
Parameters
item
MudSelectItem<T>
UpdateTextPropertyAsync(bool)
protected override Task UpdateTextPropertyAsync(bool updateValue)
Parameters
updateValue
bool
Returns
UpdateValuePropertyAsync(bool)
protected override Task UpdateValuePropertyAsync(bool updateText)
Parameters
updateText
bool