Skip to content

Conversation

danwalmsley
Copy link
Member

As the presenter realises items it currently adds them to visual children, but it does not add them to the logical children.

Because of this dynamic resource changes (which are only propagated to logical children) do not reach the column headers or cells.

This PR fixes it by adding to the logical children when an item is first attached.

private Control GetRecycledOrCreateElement(IReadOnlyList<TItem> items, int index)
{
    var item = items[index];
    var e = GetElementFromFactory(item, index);
    e.IsVisible = true;
    RealizeElement(e, item, index);
    if (e.GetVisualParent() is null)
    {
        ((ISetLogicalParent)e).SetParent(this);
        LogicalChildren.Add(e);    // this fixes it!
        VisualChildren.Add(e);

Iv also added an optional change which adds the presenters to the logical children so that column headers, rows and cells can be inspected in dev tools.

I dont remember the way to make it skip out the presenters themselves.

@grokys
Copy link
Member

grokys commented Aug 30, 2025

Hmm, I've been unable to repro dynamic resources not propagating to headers and cells. Could you modify the TreeDataGridDemo on a branch to demo the problem?

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.

2 participants