This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, The PropertyGrid control in WPFElements 3.0 is throwing an InvalidCastException when I assign an INotifyCollectionChanged implementation. In our system, each module keeps track of its own selected items in an observable collection, and it is handed out according to which module has focus at any time. The problem started showing up in one of our modules that deals with data with different generic arguments. When the content of the collection changes from an instance of the data of one generic argument to another, an InvalidCastException is occuring during ResetCommand_CanExecute in ManyEditor. When the wpf command manager issues a requery it calls up the ManyEditor with the last data in the parameter. When the handler tries to call for the RawValue of the parameter, its trying to get a value of different generic argument. You can reproduce the problem with the following example:
<Window x:Class="TestWPFDataGridBug.Window1" public partial class Window1 : Window Note that this also happens when you set the SelectedObject to a MultipleObjectWrapper(_selection) which is what our project uses (to subscribe to the PropertyChanging/PropertyChanged events). I am able to work around this issue in the meantime by not assiging the notify collection directly to the property grid (.ToList()) and resetting the SelectedObject ecah time the collection changes. But this has a considerable performace hit. Any help with this will be appreciated! Pablo
|
|
|
Thanks for alerting us to this. It appears to have been a race condition within the many editor. I've committed a candidate fix and it will be available in the next nightly build of WPF Elements 4.0. Please give it a go and let us know if you still see problems. (WPF Elements 4.0 is a free upgrade and we'd encourage you to upgrade. If upgrading isn't an option for you, let me know and I'll backport the fix to 3.0.) |
|
|
Ivan, Thanks for the quick response. Is the 4.0 upgrade available for free only to subscribers? Our team's subscrition has expired :(... Is there any way for you to point me to a solution in the 3.0 version? Thanks, Pablo |
|
|
Yes, the free upgrade requires a current subscription -- but so do 3.x nightly builds, so if your subscription has expired, then there's no point backporting it anyway, you'd still have to renew. If renewing is not an option, sorry but I don't have any suggestions better than your current workaround -- I did try a few things but no luck I'm afraid! |
|