Binding Grid.RowDefinitions / Grid.ColumnDefinitions #17820
-
Trying to bind the RowDefinitions and ColumnDefinitions properties of a grid to ViewModel class gives error AVLN3000. axaml snippet in question: <Grid
RowDefinitions="{Binding GridRows}"
ColumnDefinitions="{Binding GridColumns}"
/> cs snippet in question: public RowDefinitions GridRows { get; } = new RowDefinitions();
public ColumnDefinitions GridColumns { get; } = new ColumnDefinitions(); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The binding system requires you to bind target properties that are |
Beta Was this translation helpful? Give feedback.
The binding system requires you to bind target properties that are
StyledProperty
orDirectProperty
.Grid.RowDefinitions
is a normal CLR property. Similar to WPF, it's not designed to be binded to and mutating can be difficult. I tend to useGrid
as a fixed table layout, although not fixed cell size. However, that's not strictly the case if you're mutating in code-behind.