Search code examples
c#wpfpropertygridtoolkit

Extended WPF Toolkit PropertyGrid with Custom Attributes


I've searched the web for some introductory tutorial about the Extended WPF Toolkit PropertyGrid (http://wpftoolkit.codeplex.com) and custom attributes but didn't find. I've also downloaded the source code with the samples inside but that didn't help either. I'm a beginner with WPF so i might be missing something simple here. What i want to do is to create a simple Property Grid with some custom attributes. Does someone have a code snippet of something simple like a Property Grid with two attributes like Name and Age that are associated with some class like Person. I've already tried the snippet that they provide in the PropertyGrid documentation page on Codeplex but i couldn't get it to work. I've managed to put the Property Grid appear on the UI, but that's all, no custom attributes.


Solution

  • And your Name, Age are string/int types.. So if you assign your object as SelectedObject to PropertyGrid- it must do just fine. For example here is my code where i show application settings as property grid to the user:
    wpf:

       <extToolkit:PropertyGrid
                Name="PropertyPanel"
                IsManipulationEnabled="True"></extToolkit:PropertyGrid>
    

    codebehind:

     PropertyPanel.SelectedObject = Properties.Settings.Default;
    

    PopertyGrid assigns templates automatically, depending on property type.