Skip to content

Populate empty DataGrid Quantity per Unit column#797

Open
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/datagrid-empty-quantity
Open

Populate empty DataGrid Quantity per Unit column#797
amarinov-msft wants to merge 1 commit into
microsoft:mainfrom
amarinov-msft:amarinov/datagrid-empty-quantity

Conversation

@amarinov-msft

@amarinov-msft amarinov-msft commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes an accessibility issue on the WPF Gallery Collections DataGrid page. The Quantity per Unit column is completely empty, and when focus lands on one of its cells Narrator announces meaningless internal information instead of an empty value - flagged under MAS 1.3.1 - Info and Relationships and Trap 1.4 - Uncomprehended Element.

Change

Sample Applications/WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs
Populated QuantityPerUnit with realistic values, assigned randomly using the same generation pattern already used for the other product fields. The column now contains meaningful data, so no cell is empty.

Result

Focusing a Quantity per Unit cell now announces the actual cell value instead of the internal type-name fallback string, satisfying MAS 1.3.1. The sample data is also more complete and realistic. No XAML or visual/layout changes.

Testing

• Built WPFGallery.csproj (0 errors).
• Verified with a screen reader that Quantity per Unit cells announce their populated value

Microsoft Reviewers: Open in CodeFlow

The DataGrid sample never assigned Product.QuantityPerUnit, so every
cell in that column was empty. For an empty DataGrid cell, WPF's
DataGridCellItemAutomationPeer falls back to a name built from the row
object's ToString() (the Product type name) plus the column index, so
Narrator announced 'Item: WPFGallery.Models.Product, Column Display
Index: N' instead of an empty value.

Populate QuantityPerUnit with numeric values so the column has
meaningful data; Narrator now reads the actual cell value (MAS 1.3.1).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant