MonotouchDialog makes it very easy to create UITableView Dialogs, but sometimes questions like that one popup:
MonoTouch Dialog. Buttons with the Elements API
Now, I have a similar problem but quite different:
List<User> users = GetUsers();
var root =
new RootElement ("LoginScreen"){
new Section ("Enter your credentials") {
foreach(var user in users)
new StyledStringElement (user.Name, ()=> {
// tap on an element (but which one exactly?)
}
),
}
navigation.PushViewController (new MainController (root), true);
Now, the second parameter of StyledStringElement‘s constructor has the type of NSAction delegate, and doesn’t take any arguments, now I dunno how to determine exactly which element been tapped.
How to get that?
If it was
Tappedthen it has been selected. So you should be able to inherit fromStyleStringElementand override itsSelectedmethod to accomplish the same goal.e.g.
For Touch.Unit I created a new *Element for every item I had, TestSuiteElement, TestCaseElement, TestResultElement… to be able to customize each of them and adapt (a bit) their behaviour but I did not use this
Selectedto replaceTapped. You might want to check but it would not fit with your code pattern to create elements.