c# - StyledStringElement 'Tapped' event -
so, attempting open email interface when user clicks on 'styledstringelement' - have been calling tapped event yet have gained error -
"error cs1502: best overloaded method match `monotouch.dialog.section.add(monotouch.dialog.element)' has invalid arguments (cs1502)"
and
"error cs1503: argument
#1' cannot convert
void' expression type `monotouch.dialog.element' (cs1503)"
the code using -
section.add(new styledstringelement("contact email",item.email) { backgroundcolor=uicolor.fromrgb(71,165,209), textcolor=uicolor.white, detailcolor=uicolor.white, }.tapped += delegate { mfmailcomposeviewcontroller email = new mfmailcomposeviewcontroller(); this.navigationcontroller.presentviewcontroller(email,true,null); });
what causing error , how can fix it?
you need initialize "styledstringelement" separately
for example:
var style = new styledstringelement("contact email",item.email) { backgroundcolor=uicolor.fromrgb(71,165,209), textcolor=uicolor.white, detailcolor=uicolor.white, }; style.tapped += delegate { mfmailcomposeviewcontroller email = new mfmailcomposeviewcontroller(); this.navigationcontroller.presentviewcontroller(email,true,null); }; section.add(style);
Comments
Post a Comment