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 https://github.com/dotnet/aspnetcore/issues/20715, https://github.com/dotnet/aspnetcore/issues/5607, https://github.com/dotnet/aspnetcore/issues/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
Any thoughts?