Passing Row Data to Method for Visible Property

Hi,

I have a RadzenDataGrid and one column is a checkbox.
The check box should only be visible for some rows and not others.

I need to set the Visible property of the checkbox component:

      <RadzenDataGrid  TItem="SOQItem_Model" ... >
          <Columns>
              <RadzenDataGridColumn TItem="SOQItem_Model ....> 
                  <HeaderTemplate>
                      <RadzenCheckBox Visible="@ShowCheckbox()"  /> //<== compiler error here (missing parameter)

async Task ShowCheckbox(SOQItem_Model row_data)
{
`` return await row_data.ShowCheckbox();
}

The compiler is complaining in the DataGrid where I create the RadzenCheckBox about needing the row_data parameter for the ShowCheckbox() method, but I don't know how to do this.

How can I pass the DataGrid's row data to the ShowCheckbox method?

I worked out how to pass the row data to my method.

I will document it here encase it can help somebody in the future.

I had the ShowCheckbox() method in the wrong part of the template for the checkbox.

Wrong Location (HeaderTemplate)

              <HeaderTemplate>
                  <RadzenCheckBox Visible="@ShowCheckbox()"  /> //<== compiler error here (missing parameter)

Instead I moved the ShowCheckbox() method to the Template node and and assigned the row data to the Context attribute of the Template node (<Template Context="data">):

                    <Template Context="data">
                        <RadzenCheckBox Visible="@ShowCheckbox(data)" TriState="false" Value="@(selectedItems != null && selectedItems.Contains(data))" />
                    </Template>

This let me pass the row data to my ShowCheckbox method and it works as expected.