ICustomTypeDescriptor on JoinViewRow

  • Thread starter Thread starter Wells Caughey
  • Start date Start date
W

Wells Caughey

Hello everyone,

I am creating a view based on the code in the JoinView class, and there is
one thing I really don't understand: Why is ICustomTypeDescriptor
implemented on the JoinViewRow class? I understand why it is implemented on
JoinView, but it does not appear that anything ever calls these methods on
the JoinViewRow class. I would like to simplify my code by removing this
interface from JoinViewRow but I don't want find out later, after hours of
debugging, that it was needed all along.

Thanks,
Wells Caughey
 
Correction: JoinView does not implement ICustomTypeDescriptor, it
implements (among other interfaces) ITypedList which provides the equivalent
of the one implemented method on ICustomTypeDescriptor:
ITypedList.GetItemProperties()

Wells
 
Hi Wells,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know, why JoinViewRow class
implements ICustomTypeDescriptor interface. If there is any
misunderstanding, please feel free to let me know.

I think you're referring to the JoinView class in the following KB article.

http://support.microsoft.com/default.aspx?scid=kb;en-us;325682

In the JoinViewRow class, the ICustomTypedescriptor interface provides
dynamic type information about the row. It permits the JoinViewRow to
provide dynamic property information and custom accessor objects to binding
consumers.

Looking at the source code, we can see that JoinViewRow class only
implements the GetProperties method which enables the caller to get
information about each field(column).

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin,

Thanks for the response; the JoinView class listed in KB 325682, is exactly
what I am refering to. My question really is why is ITypedList and
ICustomTypeDescriptor implemented, but I think I've found out why.
ICustomTypeDescriptor is used if the JoinView is specified as the DataSource
AND there is a DataMember specified. I think that it is in this case that
the CurrencyManager uses ICustomTypeDescriptor to create a PropertyManager
on the CurrencyManager.Current object.

So if this is the case, and I wanted to extend JoinView such that I could
bind to child JoinViews, I would need to add the PropertyDescriptors
describing those child JoinViews to the PropertyDescriptorCollection
returned by ICustomTypeDescriptor. Would I also need to return those
descriptors from ITypedList.GetItemProperties() ?

Thanks,
Wells
 
Hi Wells,

I think your understanding is correct. If you need to make child JoinViews
on a JoinView, you also have to implement ITypedList to.GetItemProperties
to let the caller know type information about every column.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top