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 convertvoid' 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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -