You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code from section "To replace a generated column" also needs to set a .CellTemplate.
templateColumn.CellTemplate = new DataTemplate();
Without it I get an exception:
{"The type initializer for 'Missing template. Cannot initialize Microsoft.Toolkit.Uwp.UI.Controls.DataGridTemplateColumn.' threw an exception."}
" at Microsoft.Toolkit.Uwp.UI.Controls.DataGridTemplateColumn.GenerateElement(DataGridCell cell, Object dataItem)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.PopulateCellContent(Boolean isCellEdited, DataGridColumn dataGridColumn, DataGridRow dataGridRow, DataGridCell dataGridCell)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.AddNewCellPrivate(DataGridRow row, DataGridColumn column)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.CompleteCellsCollection(DataGridRow dataGridRow)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot, Object dataContext)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.InsertDisplayedElement(Int32 slot, Boolean updateSlotInformation)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GetExactSlotElementHeight(Int32 slot)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.UpdateDisplayedRows(Int32 newFirstDisplayedSlot, Double displayHeight)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.ComputeScrollBarsLayout()\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.MeasureOverride(Size availableSize)"
With it the app starts ok but I get nothing in the cells because the CellTemplate is "empty"...
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 7113de2f-2d25-7241-8a26-879c05774108
Version Independent ID: ab611ea8-0e97-71a9-ed9c-5b6570b09514
https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/datagrid_guidance/customize_autogenerated_columns#to-replace-a-generated-column
Code from section "To replace a generated column" also needs to set a .CellTemplate.
templateColumn.CellTemplate = new DataTemplate();
Without it I get an exception:
{"The type initializer for 'Missing template. Cannot initialize Microsoft.Toolkit.Uwp.UI.Controls.DataGridTemplateColumn.' threw an exception."}
" at Microsoft.Toolkit.Uwp.UI.Controls.DataGridTemplateColumn.GenerateElement(DataGridCell cell, Object dataItem)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.PopulateCellContent(Boolean isCellEdited, DataGridColumn dataGridColumn, DataGridRow dataGridRow, DataGridCell dataGridCell)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.AddNewCellPrivate(DataGridRow row, DataGridColumn column)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.CompleteCellsCollection(DataGridRow dataGridRow)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot, Object dataContext)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.InsertDisplayedElement(Int32 slot, Boolean updateSlotInformation)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.GetExactSlotElementHeight(Int32 slot)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.UpdateDisplayedRows(Int32 newFirstDisplayedSlot, Double displayHeight)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.ComputeScrollBarsLayout()\r\n at Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.MeasureOverride(Size availableSize)"
With it the app starts ok but I get nothing in the cells because the CellTemplate is "empty"...
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: