Hi, I have a ListView that contains 3 contact information(phone number, email and websites), it is possible to click in any cell of the listview and execute the correct operation (call, send email or open browser).
I set the ItemSource of the list view with a list of this kind of element:
public class infoData
{
public String type;
public String content;
public infoData (String t, String c)
{
type = t;
content = c;
}
public String Type{
get{
if(type=="tel")
return "Telephone";
if(type=="mailto")
return "Email";
else
return "WebSite";
}
set{ type = value; }
}
public String Content{
get{ return content; }
set{ content = value; }
}
public String Operation{
get{ return type+":"+content; }
}
}
Now I'd like to have this in the ViewCell: On the left the string return from Type (Telephone, Email or WebSite) and on the right the string that Content will return(ex 491847829 or test@gmail.com or www.google.com) . If I'll press the Cell i'd like to do something like this:
Device.OpenUri(new Uri( HERE));
and HERE what Operation return (tel:48915714 or emailto:test@gmail.com ...) but i can't bind it's property as I'm doing with the cell content... What is the best way to do this? should I pass an object when creating the DataTemplate?