Back to Devexpress

DxCheckBoxSettings.ValueIndeterminate Property

blazor-devexpress-dot-blazor-dot-dxcheckboxsettings-e2b3fd8f.md

latest6.0 KB
Original Source

DxCheckBoxSettings.ValueIndeterminate Property

Specifies the value that corresponds to the checkbox editor’s indeterminate state.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(null)]
[Parameter]
public object ValueIndeterminate { get; set; }

Property Value

TypeDefaultDescription
Objectnull

The value that corresponds to the checkbox editor’s indeterminate state.

|

Remarks

For predefined data types, a checkbox automatically defines the values that correspond to checked, unchecked, and indeterminate states. If a checkbox editor is bound to a custom data type, you should explicitly specify values that correspond to each checkbox state. Refer to the following topic for additional information: Change a Column Editor to Checkbox.

Set the following properties to display a checkbox editor for a column bound to a custom data type:

ValueCheckedSpecifies the value that corresponds to the checked state.ValueIndeterminateSpecifies the value that corresponds to the indeterminate state.ValueUncheckedSpecifies the value that corresponds to the unchecked state.

All other values correspond to the indeterminate state of the checkbox. If the CheckType property is set to Switch and the indeterminate state is unavailable, such values correspond to the unchecked state.

The following code snippet configures a checkbox bound to an Enum object:

razor
@inject ProductService ProductData

<DxGrid Data="@products" EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="UnitPrice" />
        <DxGridDataColumn FieldName="UnitsInOrder" />
        <DxGridDataColumn FieldName="Discontinued">
            <EditSettings>
                <DxCheckBoxSettings ValueChecked="@State.Yes"
                                    ValueUnchecked="@State.No"
                                    ValueIndeterminate="@State.Unknown" />
            </EditSettings>
        </DxGridDataColumn>
    </Columns>
</DxGrid>

@code {
    private Product[]? products;
    protected override async Task OnInitializedAsync() {
        products = await ProductData.GetData();
    }
}
csharp
public enum State { Yes, No, Unknown }

public class Product {
    public int ProductID { get; set; }
    public string ProductName { get; set; }
    public decimal? UnitPrice { get; set; }
    public short? UnitsInOrder { get; set; }
    public State Discontinued { get; set; }
}
csharp
public class ProductService {
    public Task<Product[]> GetData() {
        List<Product> products = new List<Product>();
        products.Add(new Product() { ProductID = 1, ProductName = "Chai", UnitPrice = 19, UnitsInOrder = 20 });
        products.Add(new Product() { ProductID = 2, ProductName = "Chang", UnitPrice = 19, UnitsInOrder = 40, Discontinued = State.Unknown });
        products.Add(new Product() { ProductID = 3, ProductName = "Aniseed Syrup", UnitPrice = 10, UnitsInOrder = 70, Discontinued = State.Yes });
        products.Add(new Product() { ProductID = 4, ProductName = "Mishi Kobe Niku", UnitPrice = 97, UnitsInOrder = 32, Discontinued = State.Yes });
        products.Add(new Product() { ProductID = 5, ProductName = "Ikura", UnitPrice = 31, UnitsInOrder = 10, Discontinued = State.Unknown });
        products.Add(new Product() { ProductID = 6, ProductName = "Chef Anton's Cajun Seasoning", UnitPrice = 22, UnitsInOrder = 12, Discontinued = State.No });
        products.Add(new Product() { ProductID = 7, ProductName = "Chef Anton's Gumbo Mix", UnitPrice = 21.35m, UnitsInOrder = 16 });
        products.Add(new Product() { ProductID = 8, ProductName = "Grandma's Boysenberry Spread", UnitPrice = 25, UnitsInOrder = 20, Discontinued = State.Unknown });
        products.Add(new Product() { ProductID = 9, ProductName = "Uncle Bob's Organic Dried Pears", UnitPrice = 30, UnitsInOrder = 24, Discontinued = State.No });
        products.Add(new Product() { ProductID = 10, ProductName = "Northwoods Cranberry Sauce", UnitPrice = 40, UnitsInOrder = 18, Discontinued = State.No });
        products.Add(new Product() { ProductID = 11, ProductName = "Queso Cabrales", UnitPrice = 21, UnitsInOrder = 30 });
        products.Add(new Product() { ProductID = 12, ProductName = "Queso Manchego La Pastora", UnitPrice = 38, UnitsInOrder = 10 });
        return Task.FromResult(products.ToArray());
    }
}

Specify the following properties to customize display text strings that correspond to checkbox states:

To change the value that corresponds to the indeterminate state at runtime, use the ICheckBoxSettings.ValueIndeterminate property.

Implements

ValueIndeterminate

See Also

DxCheckBoxSettings Class

DxCheckBoxSettings Members

DevExpress.Blazor Namespace