From ebcfb53160eabc51602336e60eb8dd3ba2108d29 Mon Sep 17 00:00:00 2001 From: "Aleksandar Marinov (INFRAGISTICS INC)" Date: Mon, 13 Jul 2026 16:04:07 +0200 Subject: [PATCH] Populate empty DataGrid Quantity per Unit column 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> --- .../WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sample Applications/WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs index f244e4bbb..364ed7e68 100644 --- a/Sample Applications/WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs +++ b/Sample Applications/WPFGallery/ViewModels/Collections/DataGridPageViewModel.cs @@ -30,6 +30,7 @@ private ObservableCollection GenerateProducts() var adjectives = new[] { "Red", "Blueberry" }; var names = new[] { "Marmalade", "Dumplings", "Soup" }; + var quantitiesPerUnit = new[] { "6", "10", "12", "16", "24", "48" }; //var units = new[] { "grams", "kilograms", "milliliters" }; for (int i = 0; i < 50; i++) @@ -43,6 +44,7 @@ private ObservableCollection GenerateProducts() adjectives[random.Next(0, adjectives.Length)] + " " + names[random.Next(0, names.Length)], + QuantityPerUnit = quantitiesPerUnit[random.Next(0, quantitiesPerUnit.Length)], UnitPrice = Math.Round(random.NextDouble() * 20.0, 3), UnitsInStock = random.Next(0, 100) }