Skip to content

DevExpress-Examples/winforms-property-grid-unbound-rows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Property Grid - How to implement unbound rows

The WinForms Property Grid Control does not support unbound rows out of the box. This example demonstrates how to implement this functionality using custom property descriptors. See the implementation of the CustomPropertyDescriptors event handler:

// Stores property values that are not present in the selected object.
void _PropertyGrid_CustomPropertyDescriptors(object sender, CustomPropertyDescriptorsEventArgs e) {
    if ((sender as PropertyGridControl).SelectedObject == e.Source) {
        PropertyDescriptorCollection properties = e.Properties;
        ArrayList list = new ArrayList(properties);
        list.AddRange(_UnboundRows);
        PropertyDescriptor[] result = new PropertyDescriptor[list.Count];
        list.ToArray().CopyTo(result, 0);
        e.Properties = new PropertyDescriptorCollection(result);
    }
}

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)