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

[Solved] Getting specified cell

3 Answers 103 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Zied
Top achievements
Rank 1
Zied asked on 09 Jan 2014, 03:55 PM
Hello, i'm using datagrid for windows 8 and i'm wondering how can i get the value of a certain cellule ? 
For example a cell where it meets the cellule[5] and the row[1]

Help please

Thanks

3 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 10 Jan 2014, 01:03 PM

Hi Zied,

Thank you for contacting us.

There are several methods/properties that could be useful:

  • RadDataGrid.GetDataView() - gets the current view of the grid (with applied sorting, filtering, etc.)
  • DataGridDataView.Items - collection of data items in the order they are displayed in the grid view.
  • DataGridColumn.GetValueForInstance(element from the ItemsSource) - retrieves the column value for the provided object instance. If the column is of DataGridTemplateColumn type, then the instance itself is returned.

I have attached a sample application that demonstrates how you can use these to get a specific cell value.

I hope this was useful. Please, let us know if you have further questions.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Zied
Top achievements
Rank 1
answered on 15 Jan 2014, 09:09 AM
Hello Rositsa,
 sorry but yout code throws allways an exception telling me :
Index was out of range. Must be non-negative and less than the size of the collection.
and when i checked the gridview(var gridView = this.DataGrid.GetDataView(); ) variable i found that it counts "0" i don't know why!
any idea plzz?
Thanks :)


0
Rosy Topchiyska
Telerik team
answered on 16 Jan 2014, 09:50 AM
Hi Zied,

Thank you for contacting us.

The grid view is ready to use after the RadDataGrud.DataBindingComplete event is raised, before that it's Items collection is empty. If this is not the case, could you please elaborate a bit more on the scenario where you get this exception, or send us a sample project.

I look forward to your reply.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Grid for XAML
Asked by
Zied
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Zied
Top achievements
Rank 1
Share this question
or