diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 6406589933843..d5880d3c27987 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -118,4 +118,5 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | Title | Type of change | Introduced version | |-------|---------------------------------------|--------------------| +| [Empty ColumnDefinitions and RowDefinitions are disallowed](wpf/10.0/empty-grid-definitions.md) | Source incompatible | Preview 5 | | [Incorrect usage of DynamicResource causes application crash](wpf/10.0/dynamicresource-crash.md) | Source incompatible/behavioral change | Preview 4 | diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 9f99fed62c5cb..c86e65b51010c 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -130,6 +130,8 @@ items: href: windows-forms/10.0/statusstrip-renderer.md - name: WPF items: + - name: Empty ColumnDefinitions and RowDefinitions are disallowed + href: wpf/10.0/empty-grid-definitions.md - name: Incorrect usage of DynamicResource causes application crash href: wpf/10.0/dynamicresource-crash.md - name: .NET 9 diff --git a/docs/core/compatibility/wpf/10.0/empty-grid-definitions.md b/docs/core/compatibility/wpf/10.0/empty-grid-definitions.md new file mode 100644 index 0000000000000..22fcd1e2983af --- /dev/null +++ b/docs/core/compatibility/wpf/10.0/empty-grid-definitions.md @@ -0,0 +1,64 @@ +--- +title: "Breaking change - Empty ColumnDefinitions and RowDefinitions are disallowed" +description: "Learn about the breaking change in WPF in .NET 10 where empty Grid.ColumnDefinitions or Grid.RowDefinitions declarations now cause MC3063 compilation errors." +ms.date: 08/11/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/47743 +--- + +# Empty ColumnDefinitions and RowDefinitions are disallowed + +Starting with .NET 10, WPF applications fail to build if `` or `` are declared but left empty in XAML. This results in error `MC3063`, which indicates that the property doesn't have a value. + +## Version introduced + +.NET 10 Preview 5 + +## Previous behavior + +Previously, WPF applications with empty `` or `` compiled successfully, even though the layout definitions were incomplete. The layout defaulted to a single row and column, placing all child elements in that single cell unless otherwise specified. + +Example that previously compiled: + +```xml + + + + +``` + +## New behavior + +Starting in .NET 10, the same code now fails to compile with the following error: + +```output +error MC3063: Property 'ColumnDefinitions' does not have a value. +``` + +This occurs when `` or `` elements are declared but contain no child `` or `` elements. + +## Type of breaking change + +This change can affect [source compatibility](../../categories.md#source-compatibility). + +## Reason for change + +This change is a direct consequence of implementing Grid XAML Shorthand Syntax support. + +## Recommended action + +Ensure that all `` and `` contains at least one valid or element. + +Corrected example: + +```xml + + + + + +``` + +## Affected APIs + +None.