Xamarin TableViewCell选择一个

问题描述:

我想使用Xamarin Studio制作表格视图单元格。Xamarin TableViewCell选择一个

enter image description here

公共枚举类别
{
旅游,
宾馆,旅店,
书籍
}

我使用Monotouch.Dialog,却找不到任何元素。 有什么建议吗?

我想你要找的是MonoTouch.Dialog的RadioElement。你可以在MonoTouch.Dialog introduction的3.1节看到一个例子。

从文档的例子:

var root = new RootElement ("Meals") { 
    new Section ("Dinner"){ 
     new RootElement ("Dessert", new RadioGroup ("dessert", 2)) { 
      new Section() { 
       new RadioElement ("Ice Cream", "dessert"), 
       new RadioElement ("Milkshake", "dessert"), 
       new RadioElement ("Chocolate Cake", "dessert") 
      } 
     } 
    } 
} 

有了这个例子,你就会有一个叫Meals根元素的对话框。当点击这个项目时,你会看到一个新的对话框,你可以在其中选择一个RadioElements。您为属于一起的元素创建RadioGroup,并且启动RadioGroupRootElement将显示当前选定的值。有关于此的更多信息请参见第4.8节。提供的链接也是如此。

+0

RadioElement是用于检查/取消选中该项目,我看到脚本样式粗略的示例,但我找不到细节实现,所以我发布此问题。 – ttotto

+0

是的,但'RadioElement'是您使用开箱即用的MonoTouch.Dialog元素时最接近的。 – NilsH

+0

你能告诉我一些代码片段吗? – ttotto