Skip to content

Implemented shorthand syntax for ColumnDefinitions and RowDefinitions#9956

Closed
himgoyalmicro wants to merge 3 commits into
dotnet:mainfrom
himgoyalmicro:user/himgoyal/GridXamlShorthand
Closed

Implemented shorthand syntax for ColumnDefinitions and RowDefinitions#9956
himgoyalmicro wants to merge 3 commits into
dotnet:mainfrom
himgoyalmicro:user/himgoyal/GridXamlShorthand

Conversation

@himgoyalmicro
Copy link
Copy Markdown
Contributor

@himgoyalmicro himgoyalmicro commented Oct 15, 2024

Implements #9802

Description

It will simplify the definition syntax of RowDefinitions and ColumnDefinitions by:

  • Allowing rows and columns within a Grid to be defined by a collection that is delimited
  • Creating a Typeconvertor for ColumnDefinitionCollection and RowDefinitionCollection so they can process String as its input.

Customer Impact

This feature will make Grid markup less verbose, allowing developers to create grids with simpler syntax.

Regression

N/A

Testing

Risk

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz
Copy link
Copy Markdown
Member

Great to see this going forward!

Before checking the actual code, I'd have two things:

  1. Can we not use var? Feels like JavaScript before 2015.
  2. Formatting issues (50% spaces missing before parentheses), just let VS auto format the new files imho.

Comment thread src/Microsoft.DotNet.Wpf/src/PresentationFramework/ref/PresentationFramework.cs Outdated
@dotnet-policy-service dotnet-policy-service Bot added the PR metadata: Label to tag PRs, to facilitate with triage label Oct 15, 2024
@h3xds1nz
Copy link
Copy Markdown
Member

@himgoyalmicro The changes look good to me now, I've left two more comments, along with the unresolved ones that's I think all from my side. Thank you.

@h3xds1nz
Copy link
Copy Markdown
Member

h3xds1nz commented Oct 17, 2024

@himgoyalmicro

One question; did the internal setter not work for the RowDefinitions/ColumnDefinitions properties? As discussed in #9802 by miloush. Since now they're defined a public and not internal.

Speaking of the setter, this is just a massive nitpick, but I believe the properties could be unifified in style as just:

_data ??= new ExtendedData();
_data.ColumnDefinitions = value ?? new ColumnDefinitionCollection(this);

And the getters then could be the same:

_data ??= new ExtendedData();
_data.ColumnDefinitions ??= new ColumnDefinitionCollection(this);

return _data.ColumnDefinitions;

@h3xds1nz
Copy link
Copy Markdown
Member

It would be also good to add this, so you don't have to solo-close the issues after this would be eventually merged.

Fixes #9802
Fixes #1739

@himgoyalmicro
Copy link
Copy Markdown
Contributor Author

Closing this PR in favor of #10317
Thank you @h3xds1nz for all the insightful contribution and comments. 😄
Can you please take a look at the other PR?

@github-actions github-actions Bot locked and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants