Hi, someone can help me please. I've a XamDataGrid so i want to get data when i select row. I don't know how to proceed. Anyway the method, for example show the cols result with a MessageBox. Thanks for advance.
Hi,
Thank you for your post. I have been looking into your requirement and my suggestion is to handle the ‘RecordActivated’ event of the XamDataGrid and access the data item like e.g.:
private void xamDataGrid1_RecordActivated(object sender, Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs e)
{
var dataItem = (e.Record as DataRecord).DataItem;
}
Let me know, if you need any further assistance on this matter.
I've problem with "DataRecord" (could not be found) ... ?
And the second, i want to get the value cols for e.g. in the first row that i select i want to get the name column. Thanks
Sorry not the column name but the value of the column name. Thanks!
Hi Skatox,
Thank you for your reply. I have been looking into your issue and in order to use our XamDataGrid control(and the DataRecord class) you need to add the following references:
as described in the following link from our online documentation:
http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=xamDataGrid_Getting_Started_with_xamDataGrid.html
I am not sure that you have in mind with ‘value of the column name in the first row’. Could you please explain it in details or attach a descriptive screenshot?
Looking forward to hearing from you.
Ok, i'll see. I mean that i want to get the column value for the row selected. For example i've 3 columns : NAME, AGE, ADRESS (with 3 rows) I select the second row so i would get the NAME column.
Structure :
| NAME | AGE | ADRESS |
----------------------------------------------------------
| John | 21 | Paris |
| Mike | 35 | Maroc |
| Roger | 80 | Siria |
=> I select the second row so i want to get the NAME column, means get "MIKE" ? Are you understanding ? Thanks for advance and thx for helping me
Thank you for reply. I have been looking into your requirement and the easiest way to achieve this functionality is casting the DataItem to the underlying type like e.g.:
var dataItem = (e.Record as DataRecord).DataItem as Worker;
MessageBox.Show("Person Name: " + dataItem.Name);
I am attaching a sample application(DataGridFunc.zip) that shows it.
i see it. thx....
Thank you for your replies. Let me know, if you need any further assistance on this matter.
I'm using Infrag 14.1 so i don't know what to add in the references ? this is my next pbm : i've no references and Error 4 The tag 'XamDataGrid' does not exist in XML namespace 'http://infragistics.com/DataPresenter'. Line 7 Position 10. C:\Users\Nick Adna\Documents\Visual Studio 2012\Projects\DataGridFunc\DataGridFunc\MainWindow.xaml 7 10 DataGridFunc
THX FOR ALL, IT'S SOLVED. THANKS :)
I've seen the attache files so, that's i want but for me the xamdatagrid values is from Mysql table... i have this code for query all i need :
private void loadDataToGrid() { InternshipEntities entities = new InternshipEntities(); var data = from x in entities.clients select new { x.nom_client, x.prenom_client, x.adresse_client, x.telephone_client, x.nationalite_client }; if (data != null) { datagridClient.DataSource = data.ToList(); } }
Question : HOW CAN I PROCEED WITH IT ? THE AIM IS THE SAME ABOVE. THX