Skip to content

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

@StenlyGrigorov

Description

@StenlyGrigorov

Description

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

  1. Create a .NET 10 WPF application
  2. 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.

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

  • WPF application with .NET 10 version

Other information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions