Custom SummaryTemplate

Grids for WPF Forum

Posted 15 years ago by United Biosource - United Biosource
Avatar
I'd like the [Description] attribute of each property to show up in the summary area.
I tried this:

<DataTemplate x:Key="PropertySummaryTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Margin="3"
Text="{Binding Path=Description, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}"
/>
</Grid>
</DataTemplate>

but I get this error when I select a property grid item:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='ActiproSoftware.Windows.Controls.PropertyGrid.Primitives.IPropertyDataAccessor', AncestorLevel='1''. BindingExpression:Path=Description; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

Any clues how to do this?

Comments (1)

Posted 15 years ago by United Biosource - United Biosource
Avatar
Nevermind - found the sample: Solution is


<TextBlock Grid.Column="0" FontWeight="Bold"
Text="{Binding Description}" Margin="0,0,3,0"
HorizontalAlignment="Left" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.