c#xamarin使用其他void

时间:2018-04-02 19:09:14

标签: c# visual-studio variables xamarin spinner

我有这样的空白:

public void AssignmentsTab_Click(object sender, EventArgs e) {
    // Set view to Assignments
    SetContentView(Resource.Layout.Assignments);

    //Fill ActionSpinner
    Spinner ActionSpinner = FindViewById<Spinner>(Resource.Id.ActionSpinner);
    ActionSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(ActionSpinner_ItemSelected);
    var ActionSpinnerAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.action_array, Android.Resource.Layout.SimpleSpinnerItem);
 ActionSpinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
    ActionSpinner.Adapter = ActionSpinnerAdapter;

    AssignmentListData = FindViewById<ListView>(Resource.Id.ListviewAssignments);
}

以后的这个空白:

private void ActionSpinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
{
    Spinner spinner = (Spinner)sender;
    string toast = string.Format("Selected coin is {0}", spinner.GetItemAtPosition(e.Position));
    Toast.MakeText(this, toast, ToastLength.Long).Show();
}

现在我想要在第一个void中使用微调器的值,所以我使用了这个:

var SelectedSpinnerAction = ActionSpinner.GetItemAtPosition(e.Position);

但是这会给“位置”这个词带来错误......我该怎么办?

编辑:这是错误 “'EventArgs'不包含'Position'的定义,也没有扩展方法'Position'接受第一个类型'EventArgs'的参数无法找到。”

0 个答案:

没有答案