SfGrid Custom Dynamic Styling

I am trying to add colours to a row or the cell based on the selection. I can’t seem to find any solution online. Below is the approach I have applied

<SfGrid @ref="SfInventoryGrid" AllowTextWrap="false" AllowExcelExport="true" AllowPdfExport="true"
            AllowSorting="true" DataSource="inventoryData" Toolbar="@toolbar" class="rounded-lg custom-grid" RowDataBound="OnRowDataBound">
            <GridEditSettings Mode="EditMode.Normal" AllowAdding="true" AllowEditing="true" AllowDeleting="true">
                <HeaderTemplate>
                    <span>@(GetDialogHeaderText(context as InventoryModel))</span>
                </HeaderTemplate>
                <FooterTemplate>
                    <SfButton OnClick="@Save" IsPrimary="true">@DialogButtonCaption</SfButton>
                    <SfButton OnClick="@Cancel">Cancel</SfButton>
                </FooterTemplate>
            </GridEditSettings>
            <GridEvents OnToolbarClick="OnToolbarClick" OnActionBegin="ActionBeginHandler"
                        OnActionComplete="ActionCompleteHandler" TValue="InventoryModel"></GridEvents>
            <GridToolbar>
                <GridToolBarItems>
                    @if (hasAddingAccessPermission || hasFullAccessPermission)
                    {
                        <GridToolBarItem Text="Add" PrefixIcon="e-add" Id="Add"
                                         Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                    }
                    @if (hasEditingAccessPermission || hasFullAccessPermission)
                    {
                        <GridToolBarItem Text="Edit" PrefixIcon="e-edit" Id="Edit"
                                         Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                        <GridToolBarItem Text="Update" PrefixIcon="e-update" Id="Update"
                                         Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                    }
                    @if (hasDeletingAccessPermission || hasFullAccessPermission)
                    {
                        <GridToolBarItem Text="Delete" PrefixIcon="e-delete" Id="Delete"
                                         Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                    }
                    <GridToolBarItem Text="Excel Export" PrefixIcon="e-excel-export" Id="ExcelExport"
                                     Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                    <GridToolBarItem Text="PDF Export" PrefixIcon="e-pdf-export" Id="PdfExport"
                                     Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                    <GridToolBarItem Text="Search" PrefixIcon="e-search" Id="Search"
                                     Class="hover:bg-blue-500 hover:text-white text-black"></GridToolBarItem>
                </GridToolBarItems>
            </GridToolbar>
            <GridColumns>
                <GridColumn AllowAdding="false" IsPrimaryKey="true" Field="@nameof(InventoryModel.Id)" Width="50px">
                </GridColumn>
                <GridColumn Field="@nameof(InventoryModel.Images)" HeaderText="Images" Width="230px">
                    <Template>
                        @{
                            var inventoryModel = context as InventoryModel;
                            var imageUrls = inventoryModel?.Images?.Split(',') ?? new string[0];
                        }
                        <div class="flex space-x-4">
                            @foreach (var imageUrl in imageUrls)
                            {
                                <div class="image">
                                    <img style="width:50px; height:50px;" src="@imageUrl" />
                                </div>
                            }
                            <button @onclick="() => OpenCarousel(imageUrls)" class=""><i class="fa-solid fa-expand text-blue-500 text-md hover:scale-110 ease-in transition-all duration-300"></i></button>
                        </div>
                    </Template>
                    <EditTemplate>
                        <div class="flex flex-col py-4 space-y-4">
                            @{
                                var inventoryModel = context as InventoryModel;
                                var imageUrls = inventoryModel?.Images?.Split(',') ?? new string[0];
                            }
                            <div class="flex justify-center items-center space-x-4">
                                @foreach (var imageUrl in imageUrls)
                                {
                                    <div class="flex flex-col justify-center items-center space-y-2">
                                        <img style="width:50px; height:50px;" src="@imageUrl" />
                                        <button type="button" @onclick="@(async () => await RemoveImage(imageUrl))">
                                            <i class="fa-solid fa-xmark text-blue-500 text-lg hover:scale-105 ease-in transition-all duration-300"></i>
                                        </button>
                                    </div>
                                }
                            </div>
                            @if (imageUrls.Length >= 3)
                            {
                                <p class="text-xs flex flex-wrap text-red-500">You can only upload up to 3 images. <br> Please delete existing images before <br> adding new ones.</p>
                            }
                            else
                            {
                                <SfUploader ID="uploadFiles" AllowedExtensions=".jpg,.png,.jpeg" Multiple="true" AutoUpload="true" @ref="Uploader" ValueChange="OnChange">
                                </SfUploader>
                            }
                        </div>
                    </EditTemplate>
                </GridColumn>
                <GridColumn HeaderText="Manufacturer & Description" Field="@nameof(InventoryModel.Name)" Width="220px"></GridColumn>
                <GridColumn HeaderText="Location" Field="@nameof(InventoryModel.Location)" Width="120px"></GridColumn>

                <GridColumn HeaderText="Quantity" Field="@nameof(InventoryModel.Qty)" Width="100px"></GridColumn>

                <GridColumn HeaderText="PN, SN, MODEL, ITEM #" Field="@nameof(InventoryModel.Pin)" Width="220px"></GridColumn>
                <GridColumn HeaderText="MRITS" Field="@nameof(InventoryModel.MRITS)" Width="120px"></GridColumn>

                <GridColumn HeaderText="TAG" Field="@nameof(InventoryModel.TagFirstPart)" Width="150px">
                    <EditTemplate Context="context">
                        @if (context is InventoryModel inventory)
                        {
                            <div class="flex flex-col space-y-4 flex-wrap">
                                <SfTextBox TValue="string" @bind-Value="inventory.TagFirstPart"></SfTextBox>
                                <SfDropDownList TValue="string" TItem="string" Placeholder="Tag colour" DataSource="@colour" @bind-Value="inventory.SelectedColour">
                                    <DropDownListFieldSettings Value="colour" Text="Text"></DropDownListFieldSettings>
                                </SfDropDownList>
                                <SfDropDownList TValue="string" TItem="string" Placeholder="Tag scope" DataSource="@scope" @bind-Value="inventory.SelectedScope">
                                    <DropDownListFieldSettings Value="scope" Text="Text"></DropDownListFieldSettings>
                                </SfDropDownList>
                            </div>
                        }
                    </EditTemplate>
                </GridColumn>

                <GridColumn HeaderText="BARCODE" Field="@nameof(InventoryModel.BarCode)" Width="120px"></GridColumn>
                <GridColumn HeaderText="STATUS / NOTES" Field="@nameof(InventoryModel.Status)" Width="120px"></GridColumn>

            </GridColumns>
        </SfGrid>

    @code{
    private void OnRowDataBound(RowDataBoundEventArgs<InventoryModel> args)
    {
        var inventoryModel = args.Data;
        if (inventoryModel != null)
        {
            var selectedColour = inventoryModel.SelectedColour;
            var selectedScope = inventoryModel.SelectedScope.ToLower();

            if (selectedScope == "row")
            {
                args.Row.AddClass(new string[] { selectedColour.ToLower() });
            }
            else if (selectedScope == "cell")
            {
                // Loop through cells and apply class to the TAG column cell
                foreach (var cell in args.Row.Cells)
                {
                    if (cell.Column.HeaderText == "TAG")
                    {
                        cell.AddClass(new string[] { selectedColour.ToLower() });
                    }
                }
            }
        }
    }
}

I am getting the following errors:

error CS1061: ‘CellDOM’ does not contain a definition for ‘Cells’ and no accessible extension method ‘Cells’ accepting a first argument of type ‘CellDOM’ could be found (are you missing a using directive or an assembly reference?)

is there any other approach i can use?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật