Before i begin I am very new to WPF and the xamDataCard object - so be gentle.
I have bound the xamDataCard object to a datatable and it all appears as intended.
My problem lies where i need get the data from the ClientID field of the datacard when ever the datacard is selected.
I was thinking something like
MessageBox.Show(XamDataCards1.ActiveRecord.field("ClientID").Value.ToString)
Hello,
The ClientID, per your screenshot, does not contain single value. It represents a collection of cells. When any given card is activated by selecting it you can retrieve the cell values of the selected card.
There is detail help topic on Accessing the Cell Values in RecordActivated event in our online documentation. I recommend reading it first, and if you have any questions feel free to ask. Here is the article:
http://help.infragistics.com/NetAdvantage/WPF/current/CLR4.0/?page=xamDataPresenter_Accessing_Cell_Values_in_the_RecordActivated_Event.html
Note: In the help article there is a code snippet that shows you how to retrieve the record and access the cells in the record. Keep in mind that if you have the filters enabled, as it shows in your screenshot, you would need to ensure the record type is not a FilterRecord otherwise you would get an exception when you try to reference the cells. At the beginning you can do something like:
if (e.Record is FilterRecord) return;
Sam
Thanks for the link Sam. It helped.
however, as you suggested i have run into issues when the user clicks the filter cell.
I added the line you suggested but the syntax is wrong? VB says that is FilterRecord is a Type and cannot be used in an expression.
If (e.Record Is FilterRecord) Then
Exit Sub
End If
' Check to make sure the selected Record is a DataRecord
If TypeOf e.Record Is DataRecord Then
' Cast the record passed in as a DataRecord
Dim myRecord As DataRecord = CType(e.Record, DataRecord)
' get the selected cell values
MessageBox.Show("0 " & myRecord.Cells(0).Value.ToString())
MessageBox.Show("1 " & myRecord.Cells(1).Value.ToString())
MessageBox.Show("2 " & myRecord.Cells(2).Value.ToString())
fixed.
I replaced
if(e.record is filterrecord) then
with
If TypeOf e.Record Is FilterRecord Then