C# MonoTouch.对话框:响应放射组选择

C# MonoTouch.对话框:响应放射组选择,c#,ios,xamarin.ios,radio-button,monotouch.dialog,C#,Ios,Xamarin.ios,Radio Button,Monotouch.dialog,我有一个由MonoTouch.Dialog创建的对话框。广播组中有一份医生名单: Section secDr = new Section ("Dr. Details") { new RootElement ("Name", rdoDrNames){ secDrNames } 一旦选择了医生,我希望更新代码中的元素。通知已选择RadioElement的最佳方式是什么?创建自己的RadioElement,如: class MyRadioElemen

我有一个由MonoTouch.Dialog创建的对话框。广播组中有一份医生名单:

    Section secDr = new Section ("Dr. Details") {
       new RootElement ("Name", rdoDrNames){
          secDrNames
    }

一旦选择了医生,我希望更新代码中的
元素
。通知已选择
RadioElement
的最佳方式是什么?

创建自己的
RadioElement
,如:

class MyRadioElement : RadioElement {
    public MyRadioElement (string s) : base (s) {}

    public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
    {
        base.Selected (dvc, tableView, path);
        var selected = OnSelected;
        if (selected != null)
            selected (this, EventArgs.Empty);
    }

    static public event EventHandler<EventArgs> OnSelected;
}
[更新]

以下是该放射性元素的更现代版本:

public class DebugRadioElement : RadioElement {
    Action<DebugRadioElement, EventArgs> onCLick;

    public DebugRadioElement (string s, Action<DebugRadioElement, EventArgs> onCLick) : base (s) {
        this.onCLick = onCLick;
    }

    public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
    {
        base.Selected (dvc, tableView, path);
        var selected = onCLick;
        if (selected != null)
        selected (this, EventArgs.Empty);
    }
}
公共类DebugRadioElement:RadioElement{
动作点击;
public-DebugRadioElement(字符串s,Action-onCLick):基{
this.onCLick=onCLick;
}
已选择公共覆盖无效(DialogViewController dvc、UITableView tableView、NSIndexPath路径)
{
所选(dvc、表视图、路径);
选择的var=onCLick;
如果(已选择!=null)
选中(此,EventArgs.Empty);
}
}

这将是对MT.Dialog的极大补充。在许多业务线应用程序中,一个字段的选择会影响另一个字段。谢谢你的回答!
public class DebugRadioElement : RadioElement {
    Action<DebugRadioElement, EventArgs> onCLick;

    public DebugRadioElement (string s, Action<DebugRadioElement, EventArgs> onCLick) : base (s) {
        this.onCLick = onCLick;
    }

    public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
    {
        base.Selected (dvc, tableView, path);
        var selected = onCLick;
        if (selected != null)
        selected (this, EventArgs.Empty);
    }
}