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

[Solved] Bug in RowLoaded and Row.Cells Count.

1 Answer 101 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.
Juan
Top achievements
Rank 1
Juan asked on 22 Nov 2010, 09:15 PM
Hello,

I am experiencing a not expected behavior on the RowLoaded event, when all column's width is set to a fixed value, the e.Row.Cells collection only holds the first cell, the other cells are missing.

I need to assign a tooltip to every column header, and I found it to be simple in code behind, because if I define a template for the header and assign it in the XAML, when exporting the grid, there is a lot of work to do to export the right values in the cell headers.

Then, I have the following.
private void RadGridView_RowLoaded(object sender, RowLoadedEventArgs e)
{
  if (e.Row is GridViewHeaderRow)
  {
    GridViewHeaderRow headerRow = e.Row as GridViewHeaderRow;

    GridViewHeaderCell cell = (GridViewHeaderCell)headerRow.Cells[0];
    cell.SetValue(ToolTipService.ToolTipProperty, "Column 1");

    cell = (GridViewHeaderCell)headerRow.Cells[1];
    cell.SetValue(ToolTipService.ToolTipProperty, "Column 2");

    cell = (GridViewHeaderCell)headerRow.Cells[2];
    cell.SetValue(ToolTipService.ToolTipProperty, "Column 3");

    cell = (GridViewHeaderCell)headerRow.Cells[3];
    cell.SetValue(ToolTipService.ToolTipProperty, "Column 4");
}
}
 
Then, e.Row.Cells.Count will be 4 only if at least one of the columns has its Width value to * (star), if I set all the columns's Width value to a fixed value e.Row.Cells.Count will be always 1.

Having a column's width to * (star) might be no problem, but I need an horizontal scrollbar because I currently have 15 columns to show and not all fit on the screen, so, setting on column's width to star prevents the scrollbar from showing and the MinWidth of every respect column is violated.

Any workaround?

Juan Mejia


1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 23 Nov 2010, 08:20 AM
Hello,

 Cells count depends on the grid columns virtualization which is on by default. If you set EnableColumnVirtualization to False you will get total cells count. 

Regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Juan
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or