This project has moved. For the latest updates, please go here.

PropertyGrid PropertyDefinitions not showing up

Apr 20, 2012 at 7:50 PM

I am a beginner C#/WPF user. I am trying the simple PropertyGrid example posted on this site, ie

<xctk:PropertyGrid x:Name="_propertyGrid" Width="450" Margin="10"
                <!-- Only the following properties will be displayed in the PropertyGrid -->
                    <xctk:PropertyDefinition Name="FirstName" />
                    <xctk:PropertyDefinition Name="FavoriteColor" />
                    <xctk:PropertyDefinition Name="PetNames" />

I plugged the above into my XAML. I see the PropertyGrid with the search bar, however I do not see any of the defnitionssuch as PetNames, FavoriteColor, FirstName.
What else am I meant to do to get this to work, is there a full example somewhere that I can look at? This would be helpful as I must be missing something basic, being a beginner at C#/WPF.  


Apr 20, 2012 at 8:42 PM
Edited Apr 20, 2012 at 8:43 PM



You need to set an object in the PropertyGrid's SelectedObject property.  That object is the one that the PropertyGrid is inspecting.


In the following example, the PropertyGrid is inspecting itself.  It is not very useful, but it gives you an idea of what the PropertyGrid looks like when it has content.

<xctk:PropertyGrid SelectedObject="{Binding RelativeSource={x:Static RelativeSource.Self}}" />


The example you are refering to shows how you may desactivate the properties automatic detection and how to specify the ones that you are interested in.  For that example to work, you need to put an object that has the "FirstName", "FavoriteColor" and "PetNames" properties in the PropertyGrid.SelectedObject property.

Apr 20, 2012 at 9:00 PM
Edited Apr 23, 2012 at 5:19 PM

Thank you so much! Now I can see something once I assign SelectedObject.