Avalonia
Avalonia copied to clipboard
Support Naming `ColumnDefinition` and `RowDefinition`
Is your feature request related to a problem? Please describe.
WPF supports a Name
property of both ColumnDefinition
and RowDefinition
. Avalonia does not.
Describe the solution you'd like
ColumnDefinition.Name
and RowDefinition.Name
settable from XAML and C#. Ability to lookup columns/rows by name and then set width or visiblity, etc.
Describe alternatives you've considered
No response
Additional context
Avalonia lost the name property here even though it used WPF source code for the grid because the class inheritance is different.
Column/RowDefinition in WPF inherit from FrameworkContentElement which has the name property.
I also haven't dug deeply into the Avalonia source code but since inheritance in Avalonia is ColumnDefinition : DefinitionBase : AvaloniaObject... I'm not overly optimistic this is easy to add Name support for (seems like it would need to be a control/frameworkelement).
Note that if we ever support this, Flyout is another one that would be good to support naming of.
This might actually be a lot easier than I thought.
Avalonia has the INamed interface that can be implemented on any type. Not sure code generators support it directly though. Can dig further later.
I think there was an attempt to implement INamed before. @jmacato might remember better.
@maxkatz6 sorry for the inconvenience, can you tell me if at the moment there is a workaround that would allow to get from View/ViewModel to the necessary RowDefinition without Name?
you can bind to Width/Height. Probably using a converter.