This is a migrated thread and some comments may be shown as answers.

GridViewDataColumn bound to a non primitive type raises exceptions internally

9 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jose
Top achievements
Rank 1
jose asked on 13 May 2011, 09:32 AM
Let DoubleValue be a non primitive type wrapping a double, with a TypeConverter attached that knows how to convert it from/to a Double, and suppose a GridViewDataColumn is bound via DataMemberBinding to a property of this type. Editing the value causes an InvalidCast exception, from String to DoubleValue, in GridViewDataControl.OnKeyDown. Although the exception is captured internally, it is still visible in the Output window of VS.

Going through a ValueConverter in the DataMemberBinding does not make a difference here: the same exceptions are still raised.

The internally raised exceptions are unpleasant and can cause problems with e.g. copy/paste, which I have noted in separate post.

9 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 13 May 2011, 09:40 AM
Hi jose,

 We are using internally Convert.ChangeType() for the TextBox string value which will work with IConvertible interface. If your type is IConvertible ChangeType() will work as expected. 

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
jose
Top achievements
Rank 1
answered on 13 May 2011, 10:01 AM
What's the motivation for preferring IConvertible over TypeDescriptor in your column? Specially since as the XAML parser uses TypeDescriptor to convert Strings to values, I will have to implement both!
0
Vlad
Telerik team
answered on 13 May 2011, 10:08 AM
Hello,

 This just is how Convert.ChangeType() will work - we are not sure however why this method will work only with IConvertible interface and not with TypeConverter.

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
jose
Top achievements
Rank 1
answered on 13 May 2011, 10:21 AM
Well, if you want to find out pay a quick visit to the documentation in MSDN.

I have been looking at this and implement IConvertible is not trivial for our application. Many of our non-primitive types are F# records, which is not a class and cannot implement IConvertible in a natural way. It is still possible, but very inconvenient.
0
jose
Top achievements
Rank 1
answered on 13 May 2011, 10:42 AM
Let me insist in the implications of going through IConvertible here instead of using TypeDescriptor. 
The fact that IConvertible is anti-natural to implement for F# types means that essentially any of your customers who is trying to use the RadGridView control to bind to F# values will run into this issue.
0
Vlad
Telerik team
answered on 13 May 2011, 11:29 AM
Hello jose,

 Ok. We will do our best to provide TypeConverter support as well as soon as possible. 

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
jose
Top achievements
Rank 1
answered on 13 May 2011, 11:45 AM
Excellent, very appreciated. Please update this thread when a build with this issue fixed has been released.
0
Vlad
Telerik team
answered on 15 Jul 2011, 08:08 AM
Hello Jose,

 Please try our Q2 2011 release and let me know how it goes. 

All the best,
Vlad
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
jose
Top achievements
Rank 1
answered on 15 Jul 2011, 09:32 AM
Brilliant! And very timely too. I will set some time apart to try the Q2 release as soon as I can.

Thanks,
Tags
GridView
Asked by
jose
Top achievements
Rank 1
Answers by
Vlad
Telerik team
jose
Top achievements
Rank 1
Share this question
or