To only show the ListBox.Items collection and the Content property for each item in the collection in a PropertyGridControl, do the following:
- Set the ShowProperties option to WithPropertyDefinitions.
- Define a CollectionDefinition with the Path set to 'Items'.
- Define a PropertyDefinition with the Path set to '*.Content'. The asterisk character '*' identifies an indexer [] that does not have a constant name. The path to nested properties is different for different collection items: '[0].Content', '[1].Content', etc.
The following example illustrates a PropertyGridControl bound to a ListBox control.
<para><code lang="xaml"> <dxprg:PropertyGridControl ShowProperties="WithPropertyDefinitions">
<dxprg:PropertyGridControl.SelectedObject>
<ListBox>
<ListBox.Items>
<ListBoxItem Content="First"/>
<ListBoxItem Content="Second"/>
</ListBox.Items>
</ListBox>
</dxprg:PropertyGridControl.SelectedObject>
<dxprg:CollectionDefinition Path="Items">
<dxprg:PropertyDefinition Path="*.Content"/>
</dxprg:CollectionDefinition>
</dxprg:PropertyGridControl>