I am using the Reflection API for MonoTouch.Dialog. What I want to accomplish is, when the user selects an item from a list, I want the navigation controller to go back. I don't want to force the user to click an item, then click the Back button to go back.
However, when trying to use the OnTap
attribute, my method doesn't get executed.
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
var demo = new DemoClass();
var context = new BindingContext(this, demo, "Some Demo");
var controller = new DialogViewController(context.Root);
var navController = new UINavigationController(controller);
window.RootViewController = navController;
window.MakeKeyAndVisible ();
return true;
}
public void EnumSelected()
{
InvokeOnMainThread(() =>
{
new UIAlertView("Dialog", "Enum Selected", null, "OK", null).Show();
});
}
DemoClass
public enum DemoEnum
{
SomeValue,
AnotherValue,
YetAnotherValue
}
public class DemoClass
{
[OnTap("EnumSelected")]
public DemoEnum SomeEnum;
}
I know how to navigate back with the navigation controller, but without the OnTap
working, I can't get that far. Am I missing something? Can anybody see where I am going wrong?