不从Silverlight中的RadGridView检索数据 [英] Not retrieving data from RadGridView in silverlight

查看:83
本文介绍了不从Silverlight中的RadGridView检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个动态RadGridView,我在itemsource中加载数据并将RadGridView添加到stackpanel。

我可以看到数据并在网格上对其进行排序。

但是当我使用

foreach(FirstControl.RadGridView1.Columns中的GridViewColumn列)



我只获取列名而不是列下面的数据。



我在某个地方错过了绑定吗?

这是我创建集合并将其发送到的代码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.ItemsSour ce = statisticCollection;



StackPanel1.Children.Add(Firstcontrol);



//这里的Rigth是我尝试读取网格上创建的数据。



foreach(Firstcontrol.RadGridView1.Columns中的GridViewColumn列)





这是我的xaml .--------------------------



< telerik:radgridview x:name =RadGridView1horizo​​ntalalignment =Stretchxmlns:x =#unknownxmlns:telerik =#unknown>

ItemsSource ={Binding statisticCollection,Mode = TwoWay}

AutoGenerateColumns =FalseShowGroupPanel =FalseHeight =250

VerticalAlignment =TopIsReadOnly =TrueCanUserSortColumns =true>

解决方案

您查看文档了吗?

http://www.telerik.com/help/ winforms / gridview-rows-iterating-rows.html [ ^ ]

你可以参考很多样本。例如

  string  searchingStr =  图片2; 
for int r = 0 ; r < radGridView1.RowCount; r ++)
{
if (radGridView1.Rows [r] .Cells [ 图片名称]。Value.ToString()。 ToUpper()。Equals(searchingStr.ToUpper()))
{
MessageBox.Show( 找到一场比赛);
// 做点什么
}
}


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" xmlns:x="#unknown" xmlns:telerik="#unknown">
ItemsSource="{Binding statisticCollection ,Mode=TwoWay}"
AutoGenerateColumns="False" ShowGroupPanel="False" Height="250"
VerticalAlignment="Top" IsReadOnly="True" CanUserSortColumns ="true" >

解决方案

have you check the documentation?
http://www.telerik.com/help/winforms/gridview-rows-iterating-rows.html[^]
there are lot of samples you can refer. for example

string searchedStr = "Picture 2";
for (int r = 0; r < radGridView1.RowCount; r++)
{
    if (radGridView1.Rows[r].Cells["Picture Name"].Value.ToString().ToUpper().Equals(searchedStr.ToUpper()))
    {
        MessageBox.Show("Found a match");
        //do something 
    }
}


这篇关于不从Silverlight中的RadGridView检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆