Skip to main content

DxTagBox<TData, TValue>.ValuesExpression Property

Specifies a lambda expression that identifies the Values property’s bound values when the Tag Box is placed in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<IEnumerable<TValue>>> ValuesExpression { get; set; }

Property Value

Type Description
Expression<Func<IEnumerable<TValue>>>

A lambda expression that identifies bound values.

Remarks

The ValuesExpression property obtains metadata about values bound to the Values property. Is is used when you add the Tag Box editor to Blazor’s standard EditForm component to validate the Values property value.

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

  • If you specify Values and handle the ValuesChanged event, you also need to specify the ValuesExpression property.

    <EditForm>
        <DxTagBox Data="@Strings" ...
                  Values="@values"
                  ValuesExpression="@(() => values )"
                  ValuesChanged="@ValuesChanged">
        </DxTagBox>
    </EditForm>
    
    @code {
        IEnumerable<string> values = null;
        // ...
        void ValuesChanged(IEnumerable<string> MyStrings) {
            // ...
        }
    }
    
  • If you use the @bind attribute for the Values property to implement two-way binding, you should not specify the ValuesExpression property, it is set internally.

    <EditForm>
        <DxTagBox Data="@Strings" ...
                  @bind-Values="@Values">
        </DxTagBox>
    </EditForm>
    
    @code {
        IEnumerable<string> newValues = null;
        IEnumerable<string> Values { get => newValues; set { newValues = value; InvokeAsync(StateHasChanged); } }
        // ...
    }
    

The following exception occurs if you do not use two-way binding or the ValuesExpression property:

DevExpress.Blazor.DxTagBox requires a value for the ‘ValuesExpression’ property. It is specified automatically when you use two-way binding (‘bind-Value’).

See Also