Compile error when invoking custom method on numeric input change event

What if we were required to explicitly define page properties and set their types instead of relying on the Set Property action in addition to other ways RadZen magically adds properties to pages.

The Set Property action is the only way to create a property in Radzen. It is still explicit and there is no magic around it. If you don't like that you can define properties in the partial class. Radzen detects such properties.

Also changing the way properties are defined in Radzen will not solve this particular issue. It is caused by the way Blazor infers the type of a generic component. Check this thread for example: Basic property setting of TextBox Value not binding - #21 by korchev - a few very similar definitions - some of them compile without specifying the generic argument, some don't.

Microsoft tell developers to just set the generic argument if the compiler fails to infer it. Our workaround with the Attributes does exactly that. A better solution would be to set that automatically from Radzen when the user sets the Value property of a component. We will implement that at some point - already doing a similar thing for the Data property of components with items.

For example, in page built from nested grid wizard, the data property of the nested grid is set to ${rzNwModelsInventoryShipment.ShipmentItems}

This is to allow you to have nested template contexts. Consider this:

<RadzenGridColumn>
    <Template Context="data">
         <RadzenGrid Data="@data.Items">
         <RadzenGridColumn> 
                <Template Context="data">
                </Template>
          </RadzenGrid>
    </Template>
</RadzenGridColumn>

In this case the inner Context="data" won't work as "data" is defined already. Radzen generates unique name for the context. In design time you still use ${data}.

Thanks @korchev for your reply.

As I said there are complexities I likely don't understand.

For example, it's unclear when I can use ${data} and when I cannot. I gather it's available for components that contain items. So I learned something today. :grinning:

I understand the unique naming requirement on nested templates. But instead of the magic property, could you not create a page property and then the collection would exist in the Data drop down?

For example, I have Shipments HasMany ShipmentItems HasMany ShipmentItemDetails. I added a second nested grid via RowExpand and Set Property. This results in the Data drop down showing Master (Shipments) and the 2nd Child (ShipmentItemsDetails) but not the middle child.

It seems if it were a page property it wouldn't be the exception.

Josh

For example, it's unclear when I can use ${data} and when I cannot

It is available only in templates.

I understand the unique naming requirement on nested templates. But instead of the magic property, could you not create a page property and then the collection would exist in the Data drop down?

No. The template context is different per item. The ${data} expression for the first item in a DataGrid is different from the ${data} expression of the second item. This is also how Blazor templates work. Heck I think templates in all platforms work via some "context" that represents the current data item.

This results in the Data drop down showing Master (Shipments) and the 2nd Child (ShipmentItemsDetails) but not the middle child.

The results in the Data dropdown show only page properties that Radzen knows to be of array-like type - arrays, IEnumerable etc.

Perhaps then the data drop down could be made context sensitive. For example, when manually adding a nested grid template, I must guess at the magic unique name ${rzNwModelsInventoryShipmentItem.ShipmentItemsDetails}

and hope it's correct cuz the designer says it cannot be found - even though it works at runtime.

And also the grid column editor breaks

I understand why it cannot be a page property because of row context, but how to make it not forget the data model at design time?

Why are you doing this?

In order to add a second nested grid. I’m simply copying the expression from the wizard and guessing at the name. Or looking in the generated page. Is there a better way.

I don't follow. Why can't you use ${data} as with the first child DataGrid? Are you trying to access the grand-parent data item in the innermost DataGrid?

I had no idea I could use ${data}. It works!

The first child grid (from wizard) uses the magic context name.

Please check the help article I linked before.

Thanks @korchev.

FYI - the designer still puts an error and column editor is still broken with ${data}.

I believe I read that was a known issue in another thread.