Skip to content

Feat: Add TemplateColumn<TModel, TValue> for per-cell data#15

Merged
fidarit merged 4 commits intomasterfrom
feat/template-column-2T
Dec 8, 2025
Merged

Feat: Add TemplateColumn<TModel, TValue> for per-cell data#15
fidarit merged 4 commits intomasterfrom
feat/template-column-2T

Conversation

@fidarit
Copy link
Owner

@fidarit fidarit commented Dec 8, 2025

This PR adds a new column type TemplateColumn<TModel, TValue> to TreeDataGrid. Unlike the existing TemplateColumn<TModel>, this one lets each cell have its own typed value (TValue) rather than using the whole row model. This makes it easier to work with rows that contain multiple independent objects or properties.

  • Each cell has its own data context provided by the getter function.
  • You can define per-cell read-only rules using TemplateColumnOptions<TValue>.
  • Constructor uses a resource key for templates instead of IDataTemplate to keep UI in XAML and maintain MVVM compliance.

Example

new TemplateColumn<DataRow, DataCell>(
    "Cell 0",
    row => row.Cells[0],
    "CellTemplate",
    "CellEditTemplate",
    options: new TemplateColumnOptions<DataCell>
    {
        IsReadOnlyGetter = cell => cell.IsLocked
    });

@fidarit fidarit merged commit e2f04eb into master Dec 8, 2025
1 check passed
@fidarit fidarit deleted the feat/template-column-2T branch December 8, 2025 23:44
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