Grid.IsSharedSizeScope and ColumnDefinition.SharedSizeGroup / RowDefinition.SharedSizeGroup
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
Introduce Grid.IsSharedSizeScope and ColumnDefinition.SharedSizeGroup (as well as RowDefinition.SharedSizeGroup) to .NET MAUI.
This feature enables multiple Grid instances across different UI containers (such as items inside a CollectionView, ListView, or nested BindableLayout templates) to synchronize their column widths or row heights automatically based on the longest content within a shared scope.
### End Result
When Grid.IsSharedSizeScope="True" is set on a parent element (e.g., a page or layout container), any child Grid containing a ColumnDefinition with a matching SharedSizeGroup="GroupIdentifier" will dynamically calculate its width based on the maximum width required across all grids in that scope.
This eliminates the need to hardcode column widths, estimate character lengths in ViewModels, or use proportional sizing when trying to align multi-column data across repeated, non-nested templates.
### Public API Changes
This feature introduces an attached property on Grid and a new property on ColumnDefinition and RowDefinition.
```xaml
```
### Intended Use-Case
A common UI pattern in mobile applications—especially in settings screens, order summaries, and grouped key-value detail pages (e.g., iOS Grouped Inset Tables or Android Preference screens)—requires displaying descriptive labels next to their corresponding values across multiple visual groups.
### Currently,
achieving a synchronized key-value layout across items rendered inside templates (like CollectionView or BindableLayout) requires developers to choose between flawed workarounds:
* Hardcoding widths (Width="150"): Fails localization (e.g., German translations overflowing) and looks unnatural across varied screen sizes (iOS phones vs. Android tablets).
* Proportional sizing (Width="4*, 6*"): Wastes screen space on short labels and clips long labels on small devices.
* Manual ViewModel width calculations: Requires calculating pixel/string metrics in C# before rendering, breaking clean MVVM boundaries and failing dynamic font scaling/accessibility text settings.
### Feature Reqeust
Bringing WPF's IsSharedSizeScope pattern to .NET MAUI allows developers to build clean, localized, and responsive key-value data layouts natively. Column1 (Description) can resize fluidly to fit the absolute longest text entry across all groups, while Column2 (Value) remains perfectly aligned horizontally throughout the entire view without requiring hardcoded values or manual geometry calculations.
Contributor guide
Research direction
The issue names Grid, ColumnDefinition, and RowDefinition but provides no repository files, tests, or entry point. Locate those implementations and existing layout measurement tests first, then define the shared-scope behavior and verify that matching columns or rows align across the described grids, including dynamic content changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100