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

[Solved] image binding with template column

2 Answers 163 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
prabhat
Top achievements
Rank 1
prabhat asked on 29 Jul 2009, 05:17 PM
Hi
I am fetching image from the server and i want to bind with the template
column of grid (which hold the image control) using silverlight 3.

thanks
prabhat

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 30 Jul 2009, 06:23 AM
Hi prabhat,

That is actioally quite easy to implement - you have to create a new column similar to the following:

<telerik:RadGridView Name="RadGridView1">  
    <telerik:RadGridView.Columns> 
        <telerik:GridViewColumn HeaderText="Picture">  
            <telerik:GridViewColumn.CellTemplate> 
                <DataTemplate> 
                    <Image Source="{Binding Path=ImageBytes}"/>  
                </DataTemplate> 
            </telerik:GridViewColumn.CellTemplate> 
        </telerik:GridViewColumn> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 

After the column and its new CellTemplate is defined you just have to bind the Image.Source to the correct data item property. For example, If the grid is bound to a collection ot Picture data objects that have a property PictureBytes, which stores the bytes of an image, you should bind to the property.

Best wishes,
Milan
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
prabhat
Top achievements
Rank 1
answered on 10 Aug 2009, 12:29 PM
Hi
Thanks for your answer.
But it is not working,actually i am taking image control inside the template column,
so it needs to first find the control and then bind the the controls,which is returns as bytes.
above answer is the statics binding of the controls.

Regards
prabhat
Tags
GridView
Asked by
prabhat
Top achievements
Rank 1
Answers by
Milan
Telerik team
prabhat
Top achievements
Rank 1
Share this question
or