【问题标题】:MonoTouch Dialog. Buttons with the Elements APIMonoTouch 对话框。带有 Elements API 的按钮
【发布时间】:2011-12-01 18:07:03
【问题描述】:

是否可以仅使用 Elements API 在视图上创建按钮?

var root = 
    new RootElement ("LoginScreen"){
        new Section ("Enter your credentials") {
            new EntryElement ("Username", "Your user name", "user1"),
            new EntryElement ("Password", "Your password", "", isPassword:true),
    },
    new Section () {
        new RootElement ("Login"){ 
               //Here should be a button
        }
   },
   new Section () {
        new BooleanElement ("Save your credentials", false),
   },
};

var dv = new MainController (root, true){ Autorotate = true };
navigation.PushViewController (dv, true);

我知道使用 OnTapAttribute 的反射 API 是可能的,但我想知道如何使用 Elements API 做到这一点。

当用户点击按钮时,它应该推送另一个视图控制器...

【问题讨论】:

    标签: c# xamarin.ios monotouch.dialog


    【解决方案1】:

    哦,我想我可以这样使用StyledStringElement

    new StyledStringElement ("Login", delegate{ DoLogin (); })
    

    【讨论】:

      猜你喜欢
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-15
      • 2012-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多