WinForms DataGridView and PropertyGrid behavior

91 views Asked by At

Possible Duplicate:
Make a property visible in DataGridView but NOT in PropertyGrid?

I am using both the DataGridView and PropertyGrid in an application and set it to a data source as follows:

public class Location
{
    public string Name { get; set; }
    public string Status { get; set; }
}

public class Locations: List<Location> { }

In case of the DataGridView, the Locations object is set as a data source and in case of the PropertyGrid, a single Location object is set as the SelectedObject.

I need the Status variable to display in the DataGridView but not on the PropertyGrid. The default way to hide members is to mark them with the [System.ComponentModel.Browsable(false)] attribute but that makes it disappear from both views.

Is there another way to force Status to appear on the DataGridView?

0

There are 0 answers