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

Not retrieving data from RadGridView in silverlight

1 Answer 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 13 Jun 2014, 02:10 PM
I have create a dynamic RadGridView and I load the data in the itemsource and add the RadGridView to a stackpanel.
I can see the data and sort it on the grid.
But when i use
foreach (GridViewColumn column in Firstcontrol.RadGridView1.Columns)

I only get the column name and not the data below the column.

Am I missing a binding somewhere?
This is the code where I create the collection and send it to itemsource.

int xxx = 0;
for (int j = 0; j < Rownum; j++) // Load Rows
{
var row = new ObservableCollection<dynamic>();
for (int ii = 0; ii < Colnum; ii++)
{
row.Add(statisticViewModelObect.StatisticCollection[TbCount].Rows.ElementAt(j).GetValue(xxx));
xxx++;
}
statisticCollection.Add(row);
xxx = 0;
}
Firstcontrol.RadGridView1.ItemsSource = statisticCollection;

StackPanel1.Children.Add(Firstcontrol);

//Rigth here is where I try to read the data that has been created on the grid.

foreach (GridViewColumn column in Firstcontrol.RadGridView1.Columns)


This is my xaml.--------------------------


<telerik:RadGridView x:Name="RadGridView1" HorizontalAlignment="Stretch"
ItemsSource="{Binding statisticCollection ,Mode=TwoWay}"
AutoGenerateColumns="False" ShowGroupPanel="False" Height="250"
VerticalAlignment="Top" IsReadOnly="True" CanUserSortColumns ="true" >
</telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 17 Jun 2014, 10:15 AM
Hello Roger,

The problem is that the columns are still not loaded. You can try invoking the loop for the columns in a Dispatcher call.

Hope this helps. 

Regards,
Nik
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
General Discussions
Asked by
Roger
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or