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
Setting the ColumnDefinitions/RowDefinitions properties of a Grid panel is only possible if the value is string as the ColumnDefinitionCollection/RowDefinitionCollection types do not have a public constructor #11273
With the .NET 10 version, a new functionality to simplify the definition of ColumnDefinition and RowDefinition instances for the Grid panel was introduced. The changes come from this issue.
Now, the ColumnDefinitions/RowDefinitions properties have a set method introduced with this change. However, the ColumnDefinitionCollection/RowDefinitionCollection types cannot be instantiated as they do not have a public constructor. Hence, the only possible approach is to use string as a value or create instances of ColumnDefinition/RowDefinition to be added one by one via the Add method..
Reproduction Steps
Create a .NET 10 WPF application
Add the following code Grid grid = new Grid(); grid.ColumnDefinitions = new ColumnDefinitionCollection();
Expected behavior
To not be limited to using only a value of the type of string to set the ColumnDefinitionCollection/RowDefinitionCollection properties.
Actual behavior
The ColumnDefinitionCollection/RowDefinitionCollection do not have a public constructor, hence they cannot be instantiated, and this forces the use of a value of the type of string, or create instances of ColumnDefinition/RowDefinition to be added one by one via the Add method.