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

Metadata not retrieved correctly when using aggregates

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jose
Top achievements
Rank 1
jose asked on 13 Jan 2011, 03:33 PM
I am having problems with aggregates not behaving as expected with "virtual" properties which do not exist in the type over which the aggregate function operates. The property is attached to the type using a type descriptor and redirected to an actual implementation. The Grid complains that there is no method compatible with the supplied arguments, even if the virtual property is of type int and the aggregate function does indeed exist.
This is what I believe is going on. When the grid fetches the type of the associated property to find out whether there is a function compatible with it, it gets the metadata via reflection directly instead of going through the extensible TypeDescriptor [1]. 


[1] - http://msdn.microsoft.com/en-us/library/ms171819.aspx

2 Answers, 1 is accepted

Sort by
0
jose
Top achievements
Rank 1
answered on 14 Jan 2011, 02:24 PM
I tried to work around this and failed. Let me illustrate with an example.

Suppose that I have a class C. My factory returns objects of type C, and E is the "virtual" property that I want to aggregate on. Notice that E does not exist in C. In F# :
type C () = ...
 
type Factory () =
  member makeC () : C = C()

Currently we are using the type descriptor to attach property E to C at run time, and the problem is that the grid does not check with the type descriptor when looking for a suitable aggregate function. So I tried to use an alternate design: Make the factory produce a subtype CE of C with the property E, but upcast to C before returning the object. In F# :

type CE () =
  inherit C
  member this.E : int = ...
 
type Factory () =
  member makeC () : C = upcast CE()


Unfortunately this doesn't work either, because the Grid only inspects the static type of the property and not the type of the values at runtime.

I am currently out of ideas to work around this, and time presses. The right fix is to make the Grid go through the type descriptor instead of usingdirect reflection. Would it be possible to get a hotfix ?

Thanks
0
Accepted
Veselin Vasilev
Telerik team
answered on 18 Jan 2011, 04:32 PM
Hello jose,

As my colleague already advised in the support ticket - please send us a sample project which we can debug locally.

Thank you

Greetings,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
jose
Top achievements
Rank 1
Answers by
jose
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or