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

[Solved] GridViewImage column disappears

4 Answers 110 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.
Louis
Top achievements
Rank 1
Louis asked on 16 Feb 2011, 01:01 AM
Greetings,

    I am using a GridViewIMage column using the follwing code:

<telerik:GridViewImageColumn x:Name="colItemImage" Header="Image" 
                                                 DataMemberBinding="{Binding ImagePath, Converter={StaticResource imageConverter}}"
                                                 MinWidth="75" 
                                                 Width="75" HeaderTextAlignment="Center" ImageHeight="75" ImageWidth="75" UniqueName="colItemImage" />

   The images in grid display fine, but when the column is scrolled off the screen, the column disappears and decrements the column count for the row selected.  Why is this occurring and is there a way to prevent it?  If not, would using a cell template with a standard Silverlight image control resolve the issue?

Thanks

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Feb 2011, 08:48 AM
Hello Louis,

I have tried to reproduce the issue you defined, but I was not able to. I am sending you the sample project I used for testing it.  Please take a look at it and let me know in case of any misunderstandings.
 

Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Louis
Top achievements
Rank 1
answered on 16 Feb 2011, 05:05 PM

Hi Maya,

 

                Thanks for the quick response.  Looking at your sample project it appears you are using a standard image control within a cell template and not a GridViewImage column as I am doing.  I also tried to use your technique and the problem still persists.  The only difference I can see is your image is not the first column of the grid where as mine is.   Researching this some more, I saw a posting from Pavel Pavlov stating:

                “Due to a high client demand we have introduced a horizontal virtualization to our RadGridView. This means that to increase speed and minimize memory usage RadGridView will realize only the cells needed to be displayed rather than all cells at once. “

 

                This could explain why the column count decrements when the image is scrolled off the screen.  Since I’m reading data based on the column index of the row, this poses a problem.   So my next question is there a way to read a value of a cell based on its unique column name?   If so this would resolve the issue I’m having as the column name will stay consistent even if the column count decreases and increases as columns are scrolled on and off the screen.

 

Thanks

Lou

0
Louis
Top achievements
Rank 1
answered on 16 Feb 2011, 07:29 PM
Hey Maya,

    Well I found a work around to the majority of my issues.  Since most of the columns are for display purporse only, I simply created an instance of the underlying datacontext and populated that to get the information from each cell in the row that was bound to it.  As I said this worked in most cases except the column where I have a RadNumeric Up/Down control.  I updated the underlying business object to include a QtyToOrder column and bound the Numeric Up/Down control to that to see if it would give me the value of the control.  However, using the technique I described above did not give me the value that was entered.  To resolve that, I did the following:

Dim QtyToOrdercell = row.Cells.Where(Function(c) c.Column.UniqueName = "colQty").FirstOrDefault()

This allows me to get the value from the control in the cell without any issues that I can see.   So at this point it looks like I'm continuing forward, unless of course you see an issue with what I'm doing now.

Thanks for the help.
0
Maya
Telerik team
answered on 18 Feb 2011, 05:07 PM
Hi Louis,

I am glad you found a solution working for you. Nevertheless, I would recommend you to work directly with the underlaying data item instead of the values of visual elements - the cells in this case.
 

Kind regards,
Maya
the Telerik team
Tags
GridView
Asked by
Louis
Top achievements
Rank 1
Answers by
Maya
Telerik team
Louis
Top achievements
Rank 1
Share this question
or