Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin Android布局按钮事件未触发_C#_Android_Asp.net_Mono_Xamarin - Fatal编程技术网

C# Xamarin Android布局按钮事件未触发

C# Xamarin Android布局按钮事件未触发,c#,android,asp.net,mono,xamarin,C#,Android,Asp.net,Mono,Xamarin,我对我的XAMARIN C#android项目有一个问题 目前我的代码中存在此问题: [Activity(Label = "Dashboard")] public class Index : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Index);

我对我的XAMARIN C#android项目有一个问题 目前我的代码中存在此问题:

  [Activity(Label = "Dashboard")]
public class Index : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.Index);
        Button Contact = FindViewById<Button>(Resource.Id.BtnContact);
        Contact.Click += (sender, e) =>
        {
             StartActivity(new Intent(this, typeof(Contact)));
             //SetContentView(Resource.Layout.Contact);
        };

    }

是否有人知道我遗漏了什么或忘记了什么?我看不出问题所在?

您是否尝试运行默认项目?这是一样的…那么断点呢?你试过了吗?可能StartActivity出现异常(新意图(此,类型(联系人))…它不会触发按钮事件嘿,你有什么进展吗?@StefanvandeLaarschot你能在这里发布你的解决方案吗。这可能对其他有类似问题的人有所帮助。
Contact.Click += (sender, e) => {};