Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect implementation of the ITypedList and IList interfaces? #2

Open
ujaeggi opened this issue Jan 10, 2018 · 8 comments
Open

Incorrect implementation of the ITypedList and IList interfaces? #2

ujaeggi opened this issue Jan 10, 2018 · 8 comments
Assignees

Comments

@ujaeggi
Copy link

ujaeggi commented Jan 10, 2018

Tried to use it with DevExpress.XtraGrid (DataGrids) but when set the datasource I get an error:

InvalidCastException: Unable to cast object of type 'Equin.ApplicationFramework.ObjectView`1[WindowsFormsApplication1.Customer]' to type
'WindowsFormsApplication1.Customer'.

Because it works with MS DataGridView I asked DevExpress and they told me:

This issue is an incorrect implementation of the ITypedList and IList interfaces at the BindingListView class level. To be more precise, the (BindingListView as ITypedList).GetItemProperties method returns a collection of property descriptors that describes objects of the Person type. However, the (BindingListView as IList)[] operator returns objects of the Equin.ApplicationFramework.ObjectView type. Since these types differ, the exception occurs.

They made a video: https://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/3e04901d-76af-4378-92b3-9101e7ab410e

@christianjunk
Copy link
Member

Interesting. I will see what I can do. I have found a similar issue (without any answers) on Stack Overflow: https://stackoverflow.com/questions/45883684/use-waynebloss-bindinglistview-with-devexpress-xtragrid

@ujaeggi
Copy link
Author

ujaeggi commented Jan 10, 2018

Stack Overflow question if from me :-) I asked this 4 months ago. Had no time until today to work on this project.

The workaround works but has limitations: filter is visible to the user, if the user sets a filter my set filter is deleted, I can't hide data from the user (hed needs to change the filter, can't hide it). So many disadvantages with this workaround.

There are other solutions. At the moment I filter the underlying BindingList before setting the DataSource. But this is only a workaround with many disadvantages.

BindingListView would be perfect.

@ujaeggi
Copy link
Author

ujaeggi commented Jan 16, 2018

Hi Christian

Do you think you could have a look at this issue or is this going to far? I could certainly take a look at it, but it takes a little longer until I get used to it : -)

@christianjunk
Copy link
Member

I will take a look at it tomorrow. I have downloaded a DevExpress test version and I will see what I can do for you. Regards, Christian

@ujaeggi
Copy link
Author

ujaeggi commented Jan 25, 2018

Could you find something? Should I have a look into it?

@christianjunk
Copy link
Member

So far, this is by design and I have not found an easy fix or workaround. If you or someone else has the time I would be glad if someone else can deal with this.

@ujaeggi
Copy link
Author

ujaeggi commented Feb 1, 2018

Ok. I try to have a look into it. Thank you very much for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants