Primitives Overview

This article covers the low-level visual primitives used by TreeDataGrid templates.

Primitive Roles

Important State and Pseudoclasses

  • TreeDataGridRow: :selected
  • TreeDataGridCell: :selected, :editing
  • TreeDataGridColumnHeader: :resizable

These are the key hooks for high-performance styling.

Editing Lifecycle at Cell Level

TreeDataGridCell manages:

  • begin edit (gesture-dependent)
  • commit (EndEdit) and cancel (CancelEdit)
  • value synchronization to cell model
  • CellValueChanged signal through owner grid

Begin-edit behavior is controlled by BeginEditGestures.

Styling Example

<Style Selector="TreeDataGridRow:selected">
  <Setter Property="Background" Value="#1F3A5F"/>
</Style>

<Style Selector="TreeDataGridCell:editing">
  <Setter Property="Background" Value="#FFF6D5"/>
</Style>

<Style Selector="TreeDataGridColumnHeader:resizable">
  <Setter Property="Cursor" Value="SizeWestEast"/>
</Style>

Interaction Notes

Troubleshooting

  • Editing template loses focus too early Cause: editing content is hosted in popup or descendant focus chain not tracked by custom template.

  • Checkbox cell value appears stale Cause: model does not implement expected property change notifications.

  • Row drag starts unexpectedly Cause: pointer movement exceeds drag threshold while selection gestures are active.

API Coverage Checklist