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

AutoGenerateColumns - Dynamic types....

3 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 25 Jun 2009, 11:14 PM
Greetings:

AutoGenerateColumns produces no columns when the ItemsSource is set to a generic object list or collection.  It seems that you generate the columns based on the type of the typed array/collection rather than the type of the objects within the collection.

The Integrated SilverLight GridView creates columns based upon the type of the objects within the list and does what i want - but of course it isn't near as cool as your gridview. I can see that there would be a failure if an empty generic list was passed though.

Questions:
* Could you modify your code to behave like the Silverlight GridView in this respect?
* More ideally - create a property that accepts a type that we supply and you AutoGenerate columns based upon that type.
* I'm using DynamicLinq to create ObservableCollection<object> collections, my types are dynamically generated and I would love to create ObservableCollection<RuntimeDynamicallyGeneratedClass> and supply that but I don't know how to do that at runtime, thus my generic collections.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 26 Jun 2009, 07:15 AM
Hi Doug,

We are aware of this "problem" and will try to handle it correctly in the future.

What you can do right now is to create a ObservableCollection<> with your dynamic type and treated like IList:

private static IList CreateDynamicObservableCollection(Type dynamicType) 
    return (IList) Activator.CreateInstance(typeof(ObservableCollection<>).MakeGenericType(dynamicType)); 

I have done just this in a sample project I'm sending you. Hope you will find it useful.

Sincerely yours,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jack
Top achievements
Rank 1
answered on 07 May 2010, 05:36 AM
Is this still relevant /w the latest Telerik dll's?  I'm not finding Telerik.Windows.Data.Dynamic;

thanks

jack
0
Stefan Dobrev
Telerik team
answered on 12 May 2010, 09:44 AM
Hi Jack,

This namespace has been removed and all the required classes are now part of the Telerik.Windows.Data namespace. If you want to use the Dynamic LINQ Library you can find it here. Also you can check our Silverlight's DataTable implementation here.

Regards,
Stefan Dobrev
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.
Tags
GridView
Asked by
Doug
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Jack
Top achievements
Rank 1
Share this question
or