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

Grid View column Image Binding

7 Answers 437 Views
GridView
This is a migrated thread and some comments may be shown as answers.
RajaGopal
Top achievements
Rank 1
RajaGopal asked on 22 Sep 2014, 11:54 AM
Hi,

I have a property type if Image in the Model and i do not have path of the Image. It is designed at runtime through code.

I need to display in GridView Column, but Rad Grid View Image column needs URL of the image to display.

Please let me know how to bind the Image property to the grid column to display.

Thanks
Raja Gopal

7 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 22 Sep 2014, 12:13 PM
Hi Raja Gopal,


You could take a look at the following forum thread, where the same topic was discussed. 


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
RajaGopal
Top achievements
Rank 1
answered on 22 Sep 2014, 12:34 PM
Hi Vanya,

We are not storing the image in any physical Path, we are designing the image through code.
So, there is no path for the Image to bind to GridViewImageColumn.
I have a Property of Type Image, which returns BitMapImage, i want it to be displayed in one of the grid column.

Please suggest solution.

Thanks
Raja Gopal

0
Vanya Pavlova
Telerik team
answered on 22 Sep 2014, 01:43 PM
Hello Raja Gopal,


Thank you for getting back to us. 

You may define a custom column and override CreateCellElement that will return return the desired image based on this type. The approach is similar to the following in the following documentation help article. 

 
Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
RajaGopal
Top achievements
Rank 1
answered on 22 Sep 2014, 02:35 PM
Hi,

I have tried as followed.

 <telerik:GridViewColumn Header="Image New" >
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Height="50" Width="300">
                                    <Image.Source>
                                        <BitmapImage StreamSource="{Binding BoardMemoryStream}"/>
                                    </Image.Source>
                                </Image>
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>

But, I am getting error.

  
0
Vanya Pavlova
Telerik team
answered on 22 Sep 2014, 02:53 PM
Hello Raja Gopal,



What kind of an error you are currently getting?


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
RajaGopal
Top achievements
Rank 1
answered on 22 Sep 2014, 04:06 PM
I am getting following error.

Initialization of 'System.Windows.Media.Imaging.BitmapImage' threw an exception.
0
Vanya Pavlova
Telerik team
answered on 22 Sep 2014, 05:58 PM
Hi Raja Gopal,


Thank you for getting back to us.

Using the information provided we are not able to determine what might be causing this exception by your side.

For the time being I may suggest you to take a look at the following list of exceptions and proposed resolutions here. 


Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
RajaGopal
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
RajaGopal
Top achievements
Rank 1
Share this question
or