Skip to content

Proposal: Simplify Grid Column and Row Definitions  #1739

Open
@dotMorten

Description

@dotMorten

Summary

WinUI is adding a simplified syntax to setting column and row definitions on Grid. WPF should add this too.

Current syntax

<Grid>
    <Grid.ColumnDefinitions>
          <ColumnDefinition Width="1*" />
          <ColumnDefinition Width="2*" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="300" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
          <RowDefinition Height="1*" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="25" />
          <RowDefinition Height= "14" />
          <RowDefinition Height="20" />
    </Grid.RowDefinitions>
</Grid>

Proposed Syntax

The same functionality as above with the proposed succinct syntax is shown below:

<Grid ColumnDefinitions="1*, 2*, Auto, *, 300" RowDefinitions="1*, Auto, 25, 14, 20"/>
</Grid>

Full spec described here: microsoft/microsoft-ui-xaml#673 (design is currently being finalized)

API Changes

Follow the same specification implemented by WinUI (probably no new APIs, unless it needs a new type-converter)

Intended Use Case

Developer productivity

Metadata

Metadata

Assignees

No one assigned

    Labels

    API suggestionEarly API idea and discussion, it is NOT ready for implementationEnhancement RequestedProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions