微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。