I created a custom template for a column in a Data Grid that simply conists of a Label. The label is bound to a property of my data like this ${data.MyProperty}.
This works fine and the Grid now shows the value of the MyProperty as text.
Now I want to make some programmatic customizations to the text, e.g. display a different text, based on the actual value of the MyProperty (which is by the way of int type). Therefore I created a custom method in the Page.blazor.cs file:
public string MyMethod(int input)
{
return "Something"; // this is just dummy code!
}
In the expression that binds the MyProperty data to the label in the template editor of the grid column, I now use:
${MyMethod(data.MyProperty)}
This also works great (at runtime). But once I applied the change, the Grid in the Radzen visual editor is not shown any more. Instead a warning is shown:
The name 'MyMethod' does not exist in the current context Cannot convert lamda expression to intended delegate type because some of the return types in the block are not implicitly convertable to the delegate return type.
As said, at runtime it works, only in the designer it fails. Any ideas how to fix this?
Thanks!