Back to Devexpress

WidgetFactory<TModel>.SwitchFor<TProperty>(Expression<Func<TModel, TProperty>>) Method

aspnetcore-devextreme-dot-aspnet-dot-mvc-dot-factories-dot-widgetfactory-1-dot-switchfor-1-x28-system-dot-linq-dot-expressions-dot-expression-system-dot-func-0-0-x29.md

latest1.9 KB
Original Source

WidgetFactory<TModel>.SwitchFor<TProperty>(Expression<Func<TModel, TProperty>>) Method

Creates a Switch control for an expression.

Namespace : DevExtreme.AspNet.Mvc.Factories

Assembly : DevExtreme.AspNet.Core.dll

Declaration

csharp
public SwitchBuilder SwitchFor<TProperty>(
    Expression<Func<TModel, TProperty>> expression
)

Parameters

NameTypeDescription
expressionExpression<Func<TModel, TProperty>>

A strongly-typed lambda expression. Returns a model property that supplies data to a control.

|

Type Parameters

NameDescription
TProperty

The type of the expression result.

|

Returns

TypeDescription
SwitchBuilder

An instance of SwitchBuilder.

|

Remarks

This method creates a SwitchBuilder class instance based on a data model property. Use members of this class to specify control options.

csharp
@model SampleModel

@(Html.DevExtreme().SwitchFor(m => m.ModelProperty) // create a Switch
    // call methods to specify additional control options
)

Refer to Strongly-Typed Helpers for more information.

See Also

WidgetFactory<TModel> Class

WidgetFactory<TModel> Members

DevExtreme.AspNet.Mvc.Factories Namespace