You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Blazor does not support attached properties natively (see dotnet/aspnetcore#20715, dotnet/aspnetcore#5607, dotnet/aspnetcore#22316), we have to emulate them somehow.
Currently we use the approach with separate Blazor components - either parent (e.g. GridCell) or child (e.g. ShellProperties). However, sometimes it is quite cumbersome and doesn't feel natural.
I have an alternative suggestion.
Create some AttachedPropertyRegistry class, which would allow to register actions for certain attached properties, and register them in corresponding element's static constructor. E.g. for Grid it would look smth like that:
Of course, this approach is not perfect either.
Because this property is a simple Dictionary, there would be no IntelliSense suggestions or compile time validations.
Besides, we probably won't be able to handle complex properties this way, like
Since Blazor does not support attached properties natively (see dotnet/aspnetcore#20715, dotnet/aspnetcore#5607, dotnet/aspnetcore#22316), we have to emulate them somehow.
Currently we use the approach with separate Blazor components - either parent (e.g. GridCell) or child (e.g. ShellProperties). However, sometimes it is quite cumbersome and doesn't feel natural.
I have an alternative suggestion.
Create some AttachedPropertyRegistry class, which would allow to register actions for certain attached properties, and register them in corresponding element's static constructor. E.g. for Grid it would look smth like that:
Add property to Element, which would capture all unmatched values:
And in ElementHandler try to retrieve and execute action from AttachedPropertyRegistry for all unmatched values.
This approach would allow to use syntax, very close to what is used in XAML:
Of course, this approach is not perfect either.
Because this property is a simple Dictionary, there would be no IntelliSense suggestions or compile time validations.
Besides, we probably won't be able to handle complex properties this way, like
The text was updated successfully, but these errors were encountered: