i have System.Data.DataRows with several fields, most of them just plain types like int, single, string.
what is the best way to make them editable using a propertygrid? it should work automatically no matter what kind of fields the datarow has, but it should not display all of them. i want to provide a list of properties that should be hidden.
since the DataTable is autogenerated i cannot add custom attributes like [Browsable(false)]
thanks a lot!
Edited to handle filtering; much tricker: in addition to getting the
DataRowView
, we need to provide a custom component that pretends (via pass-thruPropetyDescriptor
s) to be theDataRowView
(which is itself pretending to be theDataRow
) - and filter out the properties that we don't want.Very interesting problem ;-p Easier to solve in classic classes, but the below works for
DataRow
;-pNote that you could do other things in this area to make some of the properties non-editable (
IsReadOnly
), or have a different caption (DisplayName
), or category (Category
) - by overriding other members inRowWrapperDescriptor
.