views:

124

answers:

1

I'm looking for reading object type bind to BindingSource.

In debugger mode I've drilled down BndingSource object and I've found non-public property named "BindType" what contains interested info.

(Also found property "ItemType" what contains also such info - but I'm not sure it will work if BS.Count == 0)

Can you please advice how to read / access that info ?

A: 

I've found solution myself - giving it here - maybe helps someone :)

 private static string ObjectHostedByBS (BocBindingSource bs) {
  if (bs == null) return string.Empty;


  ITypedList tl = bs as ITypedList;
  var a = tl.GetItemProperties(null);

  // no prop read
  if (a == null || a.Count == 0) return null;

  return a[0].ComponentType.Name;
 }
Maciej