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

Insert Image in to cells on selected rows

1 Answer 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alon Ashkenazi
Top achievements
Rank 1
Alon Ashkenazi asked on 25 Nov 2009, 10:53 PM
Hi,
How Can I set a image in to specific cell on all selected rows.
i tried something like this:
foreach (MyObject obj in MyGrid.SelectedItems) 
System.Windows.Controls.Image image = new System.Windows.Controls.Image(); 
        image.Source = new BitmapImage(new Uri(@"[...]")); 
        ((MyObject)MyGrid.SelectedItem).myImageimage

the problem with this code is that the last row is the only row effected.

1 Answer, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 26 Nov 2009, 07:08 AM

Hello Alon Ashkenazi,

You could modify your code like this:

foreach (MyObject obj in MyGrid.SelectedItems) 
    System.Windows.Controls.Image image = new System.Windows.Controls.Image(); 
        image.Source = new BitmapImage(new Uri(@"[...]")); 
        ((MyObject)obj).myImage= image; 
}

Or take a look at the sample that I have attached to this project - it uses another approach to show images for all selected items.

Hope this helps.


Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Alon Ashkenazi
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or