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

Grid values from Telerik.Windows.Data.DataItemCollection

1 Answer 284 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 10 Mar 2011, 01:41 PM
Hi there.

I've got a converter on my RadGridView, and the passed in object to 'Convert' is Telerik.Windows.Data.DataItemCollection. I want to set a column in my data grid using some of this data (the conversion of the bitmap image in one field requires the image width and height, stored in other fields). So I want to do something that might follow this pseudocode:

Convert value to some usable data (some collection where I can access the fields).
Access data and find fields for image data, image width and image height.
Set a field of the data grid (that the converter is on) with the image which is converted.

How can I do this?

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 15 Mar 2011, 02:02 PM
Hello,

 You can use OfType<>() or Cast<>() to cast the DataItemCollection items to your object type and later access desired properties. For example:

foreach(var customer in RadGridView1.Items.OfType<Customer>())
{
   customer.CompanyName = "MyValue";
}

All the best,
Vlad
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Steve
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or