Implementing a Watch Window

Grids for WPF Forum

Posted 13 years ago by Tom P.
Version: 11.1.0542
Avatar
Looking to implement a Visual Studio style watch Window, and it occurred to me that the PropertyGrid is 90% of what we want.

Any suggestions on how to do it? I would definitely like to have the nested expansion like the Watch Window.

What do you think?

Comments (4)

Posted 13 years ago by Tom P.
Avatar
Hmm, so I see PropertyExpandability, check!

I need to add a Type column, I'm assuming that's doable, also, I'd like to change the Child expander to be a + instead of a wedge, but that's just Style.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tom,

The control in the Watch window is a bit different than the traditional PropertyGrid. The PropertyGrid generally just shows properties, while the watch window also shows fields. Also, properties are generally grouped by type, with expandable "base" nodes to see additional fields.

Most of this should be doable in our PropertyGrid, but would require a good bit of customization.


Actipro Software Support

Posted 13 years ago by Tom P.
Avatar
Fields shouldn't be an issue, we are tightly controlling what we want to show.

The Type Column is really what I think is missing, but, I see the super-awesome-didn't-know-it-existed TreeListView base class has a Columns collection! I presume I can add a Column to the PropertyGrid in this way (tried it), but the hard part will be figuring out the right thing to bind to in the CellContainerTemplate.

Thoughts?

And seriously, you guys should promote the heck out of the TreeListView class, it's amazing, we wrote our own, but yours is crazy good.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Tom,

The TreeListView doesn't currently have all the supported themes or documentation, as it was originally intended to be a basis for the PropertyGrid. We have a TODO item marked down to fully "productize" it.

The name column binds to the DisplayName property of the associated IPropertyDataAccessor. While the value column binds to the Value or ValueAsString property. You could bind your custom type column to the ValueType property, which indicates the type of the property. Something like the following should work. Something like the following should work, you'd just set the TreeListViewColumn.CellContainerStyle to this Style:
<Style x:Key="TypeCellContainerStyleKey" TargetType="{x:Type propgrid:TreeListViewCell}">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="propgrid:TreeListViewCell">
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true" Padding="{TemplateBinding Padding}">
                    <TextBlock Margin="4,0,0,0" VerticalAlignment="Center"
                            Text="{Binding ValueType, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>


Actipro Software Support

The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.