Home > Support > Forum

how to get text from touchlist

Posted by sameertm 
how to get text from touchlist
June 04, 2012 09:43AM
hi all

In my application i have touchlist ,it has set of data's,when i click certain data in touchlist , i need to get the selected text from the touchlist, how i can get it ?
Re: how to get text from touchlist
June 05, 2012 04:11AM
Hello Sameer,

RowItemClicked event will occur when the user clicks on a specific item in a row.
You can also use SelectedIndexChanged or SelectedItemPressed (it occurs when the selected row was pressed again).
private void touchList1_RowItemClicked(object sender, RowItemClickedEventArgs args)
{
Row clickedRow = this.touchList1.Rows[args.RowIndex];
RowItemText itemText = clickedRow.Items["ContactName"] as RowItemText;

if (itemText != null)
{
// Show selected text
MessageBox.Show(itemText.Text);
}
}

To get the values from selected row, you can use touchList1.Rows collection. You can get the selected row either by args.RowIndex or by touchList1.SelectedIndex property.
Every row can have different RowItems, so you need to get the right item from the collection of items by its name (defined during the design time).
Class RowItem is the base class for RowItemText, RowItemImage, RowItemCheckBox etc. Therefore we have to convert it to the correct type, and then we can access its properties.

Best regards,
Gabriel
the BeeMobile team
Sorry, only registered users may post in this forum.

Click here to login