1

I am using the PropertyGrid from the Xceed WPF Extended Toolkit. Is there a way that I can make all properties expanded by default? Actually, I'll never need them to be "unexpanded" ever, so if the "un-expansion" (is there a word for that, BTW?) could be disabled, that would be even better.

Henrik Berg
  • 519
  • 5
  • 21
  • I realise this isn't an actual answer, but have you seen Syncfusion is giving away their full suite ... https://www.syncfusion.com/products/communitylicense ... the benefit here is that they have their own forums where the technical staff answer questions directly. I have no affiliation to Syncfusion! – 3-14159265358979323846264 Nov 05 '15 at 10:17
  • I meant to say Syncfusion includes a property grid! – 3-14159265358979323846264 Nov 05 '15 at 10:20

3 Answers3

2

If you are still looking for a way to do this, I just figured it out myself.

private void PropertyGrid_SelectedObjectChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
    var grid = sender as PropertyGrid;

    foreach (PropertyItem prop in grid.Properties)
    {
        if (prop.IsExpandable) //Only expand things marked as Expandable, otherwise it will expand everything possible, such as strings, which you probably don't want.
        {
            prop.IsExpanded = true; //This will expand the property.
            prop.IsExpandable = false; //This will remove the ability to toggle the expanded state.
        }
    }
}
Bradley Uffner
  • 16,641
  • 3
  • 39
  • 76
0

If you set IsCategorized="False" you will see all properties expanded by default:

<xceed:PropertyGrid IsCategorized="False" SelectedObject="{Binding}"/>

Also you can specify

ShowPreview="False" ShowSearchBox="False" ShowSortOptions="False"
ShowSummary="False" ShowTitle="False" ShowAdvancedOptions="False"

to disable all other parts than main property editor grid.

0
_propertyGrid.ExpandAllProperties();
uzrgm
  • 375
  • 3
  • 8