Back to Devexpress

DxListBox<TData, TValue>.ValueExpression Property

blazor-devexpress-dot-blazor-dot-dxlistbox-2-4b9920c7.md

latest2.7 KB
Original Source

DxListBox<TData, TValue>.ValueExpression Property

Specifies a lambda expression that identifies the Value property’s bound value when the List Box is in the EditForm.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }

Property Value

TypeDescription
Expression<Func<TValue>>

A lambda expression that identifies a bound value.

|

Remarks

The ValueExpression property obtains metadata about the value bound to the Value property. It is used when you add a DxListBox<TData, TValue> to Blazor’s standard EditForm component to validate the Value property value.

You can use one of the following ways to set up this property:

razor
<DxListBox Data="@Strings"
           Value="@Value"
           ValueExpression="@(() => Value )"
           ValueChanged="((string v) => Value = v)" />
  • Use the @bind attribute for the Value property to implement two-way binding. In this case, the ValueExpression property is set internally.
razor
<DxListBox Data="@Strings"
           @bind-Value="@Value" />

@code {
    String newValue = null;
    String Value { get => newValue; set { newValue = value; } }
    @* ... *@
}

The following exception occurs if you do not use two-way binding and do not specify the ValueExpression property:

The ‘ValuesExpression’ or ‘ValueExpression’ property is required. Use two-way binding (‘bind-Value’ or ‘bind-Values’) to define these properties automatically.

See Also

DxListBox<TData, TValue> Class

DxListBox<TData, TValue> Members

DevExpress.Blazor Namespace