Back to Devexpress

BlazorViewExtensions.CustomizeViewItemControl(View, Controller, Action<ViewItem>, String[]) Method

expressappframework-devexpress-dot-expressapp-dot-blazor-dot-utils-dot-blazorviewextensions-dot-customizeviewitemcontrol-x28-view-controller-action-viewitem-string-x29.md

latest3.6 KB
Original Source

BlazorViewExtensions.CustomizeViewItemControl(View, Controller, Action<ViewItem>, String[]) Method

Allows you to access and customize controls of the specified View Items in ASP.NET Core Blazor applications. This applies to View Items in Detail View, Dashboard View, and List View (DxGridListEditor and DxTreeListEditor in edit mode)

Namespace : DevExpress.ExpressApp.Blazor.Utils

Assembly : DevExpress.ExpressApp.Blazor.v25.2.dll

NuGet Package : DevExpress.ExpressApp.Blazor

Declaration

csharp
public static void CustomizeViewItemControl(
    this View view,
    Controller controller,
    Action<ViewItem> customizeAction,
    params string[] viewItemsId
)
vb
<ExtensionAttribute>
Public Shared Sub CustomizeViewItemControl(
    view As View,
    controller As Controller,
    customizeAction As Action(Of ViewItem),
    ParamArray viewItemsId As String()
)

Parameters

NameTypeDescription
viewView

A View that contains the specified View Item.

| | controller | Controller |

A Controller to customize controls of the specified View Item.

| | customizeAction | Action<ViewItem> |

A method to customize controls of the specified View Item.

| | viewItemsId | String[] |

The View Item identifier.

|

Remarks

The following code snippet uses the CustomizeViewItemControl(View, Controller, Action<ViewItem>, String[]) method to enable HTML markup in a Static Text component:

File :
MySolution.Blazor.Server\Controllers\CustomizeViewController.cs

csharp
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Editors;
using DevExpress.ExpressApp.Blazor.Utils;

namespace MySolution.Blazor.Server;

public class CustomizeViewController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
            View.CustomizeViewItemControl(this, item => {
                if(item is StaticTextViewItem staticTextViewItem) {
                    staticTextViewItem.ComponentModel.UseMarkupString = true;
                }
            }, "StaticTextViewItemId");
        }
    }

See Also

BlazorViewExtensions Class

BlazorViewExtensions Members

DevExpress.ExpressApp.Blazor.Utils Namespace