Implemented shorthand syntax for ColumnDefinitions and RowDefinitions#10866
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a shorthand syntax for defining grid rows and columns by introducing type converters that allow string conversion to RowDefinitionCollection and ColumnDefinitionCollection, and updates grid properties accordingly.
- Added ColumnDefinitionCollectionConverter and RowDefinitionCollectionConverter classes.
- Modified Grid, RowDefinitionCollection, and ColumnDefinitionCollection to support owner management and simplified property setters.
- Adjusted API compatibility baselines to reflect the attribute changes.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| PresentationFramework.cs | Added converter stubs for collection type conversion. |
| WpfGeneratedKnownProperties.cs | Updated delegates and TypeConverterType assignments for grid properties. |
| RowDefinitionCollectionConverter.cs and ColumnDefinitionCollectionConverter.cs | Implemented string conversion for row/column definition collections. |
| RowDefinition.cs and ColumnDefinition.cs | Updated constructors and owner setters to decouple from the grid. |
| Grid.cs | Added setters for ColumnDefinitions/RowDefinitions and incorporated owner management. |
| PresentationFramework.csproj | Included new converter files. |
| ApiCompat Baseline | Reflects modifications in attributes on Grid properties. |
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Grid.cs:283
- [nitpick] The exception message uses inconsistent naming (using 'nameof(value)' here versus 'nameof(Grid)' elsewhere) in the owner assignment logic; standardize the parameter names for clarity.
throw new ArgumentException(SR.Format(SR.GridCollection_InOtherCollection, nameof(value), nameof(ColumnDefinitionCollection)));
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10866 +/- ##
===================================================
- Coverage 13.42191% 13.41294% -0.00897%
===================================================
Files 3317 3319 +2
Lines 664749 664895 +146
Branches 74643 74675 +32
===================================================
- Hits 89222 89182 -40
- Misses 572982 573165 +183
- Partials 2545 2548 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #9802
Description
It will simplify the definition syntax of RowDefinitions and ColumnDefinitions by:
Decoupled RowDefinitionCollection and ColumnDefinitionCollection from the owner grid to ensure VS Hot Reload functionality remains intact.
Customer Impact
This feature will make Grid markup less verbose, allowing developers to create grids with simpler syntax.
Regression
N/A
Testing
Local build pass
Risk
Low
PS earlier this was being tracked by #10317 but using this PR now to make the commit history cleaner.
Microsoft Reviewers: Open in CodeFlow