I am running into an issue when using the Gridview. I have a Gridview which has the columns defined declaratively in the xaml. There are several controls such as buttons, checkboxes, etc... in the column definitions. I use the GridViewColumns as illustrated below:
<telerik:GridViewColumn> |
<telerik:GridViewColumn.CellTemplate> |
<DataTemplate> |
<CheckBox VerticalAlignment="Center" x:Name="NextQueue"></CheckBox> |
</DataTemplate> |
</telerik:GridViewColumn.CellTemplate> |
</telerik:GridViewColumn> |
I set the commandparameters of these elements in the rowloaded event on the GridView. Everything works fine until I scroll the gridview. The rowloaded event throws multiple errors. It appears that several of the elements that are available when the row loaded event first fires are not available when the rowloaded event fires when the scrollbar is used. For example here is how I access one of the checkboxes in the rowloaded:
var row = e.Row as GridViewRow; |
var selectedButton = row.Cells[0].ChildrenOfType<CheckBox>()[0]; |
selectedButton.CommandParameter = targetDub; |
When this runs when the grid is initially loaded it works fine. As soon as the user scrolls the grid it throws an exception because the row.Cells[0].ChildrenOfType<CheckBox>() returns a count of 0. This is the case when I try to find any of the controls on that row.
What could be causing this?