xamarin - 从 ViewModel 类动态返回颜色
问题描述
我是 Xamarin 表单应用程序开发的新手,我正在尝试从我的 ViewModel 类中返回“颜色”,但我也面临同样的问题。它在 Android 设备上运行时运行良好,但在 iOS 上运行时出现以下错误:
The name 'Color' does not exist in the current context
The type or namespace name 'Color' could not be found (are you missing a using directive or an assembly reference?)
我尝试在 iOS 项目中添加 System.Drawing dll,但错误仍然存在,我还使用 NuGet 更新了所有组件。
我的代码片段:
public class Ticket: BaseViewModel
{
// Property to return
public Color PriorityColor
{
get
{
if( condition ) {
return Color.Red;
} else if( condition ) {
return Color.Black;
} else {
return Color.Yellow;
}
}
}
}
解决方案
推荐阅读
- list - prolog 谓词返回事实(?)
- charts - Google Datastudio 多个重新分区和类型图表
- magento2 - Magento2.0 服务器要求 - 需要指导
- amp-html - AMP 中的 Brightcove 视频对接
- apache-storm - [Storm]如果其中一个失败,锚定到相同消息 id 的其他元组会发生什么?
- java - BridJ:加载 Clp.dll 时发生 LoadLibrary 错误:动态链接库 (DLL) 初始化例程失败
- oracle - varchar 立即执行
- json - 在没有反斜杠的请求中发送 JSON
- python - pyspark 中的重型有状态 UDF
- xamarin - 来自 HttpWebResponse 的流上的 xamarin IOS ReadToEnd() 不起作用