DxListBox<TData, TValue>.Attributes Property
Specifies a collection of standard HTML attributes applied to the List Box.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object> Attributes { get; set; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<String, Object> | A collection of attributes. |
Remarks
To apply a standard HTML attribute to the List Box, specify the attribute’s name and its value among List Box properties in the markup. If the specified name does not match an existing List Box property name, the component passes the specified value to the Attributes
collection.
You can use the Attributes
collection to add List Box attributes at runtime.
If you specify the CssClass property and class attribute in the Attributes
collection at the same time, the List Box applies the CssClass property value.
The code snippets below set a custom value to the List Box title attribute at design time and runtime.
<DxListBox
Data="@Cities"
@bind-Values="@Values"
title="A sample List Box tooltip.">
</DxListBox>
@code {
IEnumerable<string> Cities = new List<string>() {
"London",
"Berlin",
"Paris",
};
<DxListBox
Data="@Cities"
@bind-Values="@Values"
Attributes="ListBoxAttributes">
</DxListBox>
@code {
IEnumerable<string> Cities { get; set; }
IEnumerable<string> Values { get; set; }
Dictionary<string, object> ListBoxAttributes { get; set; } = new();
protected override void OnInitialized() {
Cities = new List<string>() {
"London",
"Berlin",
"Paris",
};
ListBoxAttributes["title"] = "A sample List Box tooltip.";
}
}