C# Xamarin 中的 Spinner 类没有被重新定义

问题描述

我正在使用 VS 和 C# 使用 Xamarin, 我正在尝试获取对 XAML 文件中的微调器的引用,但 C# 根本无法识别微调器类,是否有任何包或任何方法可以更改它?

添加代码: XAML:

# Variables
x = model.addVars(nodeCount,nodeCount,vtype=g.GRB.BINARY) # matrix of size nodeCount * nodeCount,where x[i,j] denotes if node i is topologically before node j

#Constraints
for e in edges:
    model.addConstr(x[e.child,e.parent] == 1 - x[e.parent,e.child])  # x[i,j] needs to be equal to negative value of x[j,i]

    for k in range(nodeCount):
        model.addConstr(  x[e.parent,e.child] + x[e.child,k] - x[e.parent,k] <= 1) # Without this constraint solver produced invalid ordering results so I came up with this equation. But I'm not sure if this is the best way to solve this issue..


# Objective
sumNegativeEdges = 0;
for e in edges:
    sumNegativeEdges+= (x[e.child,e.parent]) * e.weight; # Adding just weight of edges where child is topologically before the parent

model.setobjective(sumNegativeEdges,g.GRB.MINIMIZE) 

c# 代码

<Spinner
            android:id="@+id/ingSpr"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_column="0"
            android:layout_row="0"/>

错误

Spinner spinner = FindViewById<Spinner>(Resource.Id.ingSpr);

解决方法

我能够重现相同的错误。

enter image description here

添加 Android.Widget 的引用可以解决这个问题。

using Android.Widget;