Ticket Q502502
Visible to All Users

GridControl hides columns defined by parent interface

created 12 years ago

Hello,
In my application I met an issue with derived interface. Fortunately I can reproduce it in simple solution, so I am attaching it.
If you run attached example, you will see DataGrid with single column: Favourite Shop. That's one of IWoman properties. But IWoman contains also properties derived from IPerson: FirstName, SecondName, Comments. My question is why GridControl doesn't see them?
In my application I tried to prepare the columns in designer, but it didn't help. The columns remained empty.
The only workaround I found was to use BindingList<Women> instead of BindingList<IWoman> . But that's not nice solution, I need an interface.
Can you please look at it? It sounds to me like DevExpress bug: GridControl doesn't see properties defined by parent interface.
Note1: I tried also 13.1 version, the bug is still there.
Note2: The problem is not visible on all machines. Some machines show all 4 columns, some of them show only 1 column.

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

Hi Robert,
Our Grid uses the same way to obtain columns as the standard DataGridView. It gets the type of the list indexer property (the type by which a list is typed) and uses the standard TypeDescriptor.GetProperties method to get properties of the obtained type. In your case, the IWoman interface is a type of the list indexer property and that type has only one FavouriteShop property. Thus, the Grid can obtain only this very property. If you replace our Grid with the standard DataGridView, you will see the same behavior.
To resolve the issue, you can implement your own list that implements the ITypedList interface and return in the ITypedList.GetItemProperties method a collection of desired properties.
Another approach is to use unbound columns.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.