This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Is there a way to display the underlying TreeListView's Column Headers in the PropertyGrid? I'm attempting the following but not having much luck: TreeListView tlv = (TreeListView)(propertyGrid.Template.FindName("PART_Grid", propertyGrid)); |
|
|
That won't work because tlv.Columns[0].Header = hdr0 doesn't change the header container that appears at the top of the column, it just tells WPF to display hdr0 inside that conteiner. (In other words, it doesn't matter that the hdr0 is a GVCH itself: it's the same as if you'd set Header to a string or a TextBlock.) Instead, you need to get at the ColumnHeaderContainerStyle of the TreeListView and set it to a style that doesn't hide the headers (in fact, not setting the style at all will do). This requires getting into the ControlTemplate of the TreeListView. Because the relevant part of the TLV template is not named, doing this the "correct" way requires retemplating the property grid so that you can retemplate the inner TLV. If, however, that sounds like rather heavy going, you can do it in code as follows. 1. Create the TreeListView control template as a resource. It should be as follows: <ControlTemplate x:Key="ShowHeaders" TargetType="{x:Type ms:TreeListView}"> This is the same as the default TLV control template except that it does not set the GridViewHeaderRowPresenter.ColumnHeaderContainerStyle. (The default template sets a style that hides the headers.) 2. Assign this template to the TLV that is part of the property grid template: TreeListView tlv = (TreeListView)(pg.Template.FindName("PART_Grid", pg)); Notes: If you want to perform your own styling on the headers, you can do so by creating your own ColumnHeaderContainerStyle, and applying it to the GridViewHeaderRowPresenter in the custom TLV template. |
|