MonoTouch 对话框.带有 Elements API 的按钮 [英] MonoTouch Dialog. Buttons with the Elements API

查看:14
本文介绍了MonoTouch 对话框.带有 Elements API 的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to create buttons on the view using only 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 做到这一点.

I know it's possible with Reflection API using OnTapAttribute, but I wonder how to do that with Elements API.

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

And when user taps on the button it should Push another view controller...

推荐答案

哦,我想我可以像那样使用 StyledStringElement

Oh I guess I can use StyledStringElement like that

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

这篇关于MonoTouch 对话框.带有 Elements API 的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆