DisplayMemberBinding and DataTemplates in TreeListViewColumn

Grids for WPF Forum

The latest build of this product (v24.1.2) was released 3 months ago, which was before this thread was created.
Posted 22 days ago by Stefan Angerer
Version: 24.1.2
Platform: .NET 6.0
Environment: Windows 11 (64-bit)


I try to use the DisplayMemberBinding property from TreeListViewColumn.

If I do this the DataContext and Content for the ContentPresenter of the Cell suddendly is a PixelSnapper (From Actipro Namespace)

The Border (Child of TreeListViewItemCell, Parent of the ContenPresenter) has the expected DataContext.

So if I use the DisplayMemberBinding I can't use DataTemplates anymore. I wan't to do a combination to enable dynamic columns.

Regards Stefan

Comments (1)

Posted 21 days ago by Actipro Software Support - Cleveland, OH, USA


If you use DisplayMemberBinding, it will create a TextBlock with the DataContext being set to your expected DataContext, and the TextBlock.Text property being bound using the DisplayMemberBinding.  In that case, a PixelSnapper also wraps the TextBlock to ensure an even height.  That PixelSnapper is used as the cell's Content.

When not using DisplayMemberBinding, the DataContext is used as the cell's Content and cell templates will be available.

That is by design.  If you want to use DataTemplates, you'd have to not use DisplayMemberBinding.

Actipro Software Support

Add Comment

Please log in to a validated account to post comments.