PropertyGrid - display summary as tooltip?

Grids for WPF Forum

Posted 2 years ago by John Dailey
Version: 22.1.1
Avatar

Hi, I'm evaluating the PropertyGrid control and have a small problem:

I need a property grid in a smaller onscreen space where the full grid doesn't fit.  Users scroll through the properties, but the summary box is often not visible, scrolled past the bottom.  I need the summary information  (information from the property's [Description("....")] attribute) available as a tooltip over each line item.  

Is this possible with the PropertyGrid?

Comments (4)

Answer - Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

Yes, if you turn off the summary area, then just set this and you should get descriptions in the tooltips for the name cells:

<grids:PropertyGrid DataObject="{Binding}" CanClearDataObjectOnUnload="True">
	<grids:PropertyGrid.DefaultStringNameTemplate>
		<DataTemplate>
			<Grid Background="Transparent" ToolTip="{Binding Description}">
				<shared:AdvancedTextBlock x:Name="textBlock" Margin="5,3,1,3" Text="{Binding DisplayName}" 
										TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
			</Grid>

			<DataTemplate.Triggers>
				<DataTrigger Binding="{Binding IsReadOnly}" Value="True">
					<Setter TargetName="textBlock" Property="Opacity" Value="0.7" />
				</DataTrigger>
			</DataTemplate.Triggers>
		</DataTemplate>
	</grids:PropertyGrid.DefaultStringNameTemplate>
</grids:PropertyGrid>

It's basically the default "DefaultStringNameTemplate" value, except a Grid was added with a ToolTip set.


Actipro Software Support

Posted 2 years ago by John Dailey
Avatar

This seems to work with some modification -- the tooltip needs to also be on the <shared:AdvancedTextBlock /> element.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

You could just set IsHitTestVisible="False" on the AdvancedTextBlock instead.


Actipro Software Support

Posted 2 years ago by John Dailey
Avatar

Yes, that also seems to work well.  Thank you!

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

Add Comment

Please log in to a validated account to post comments.