xamarin - Xamarin Forms uwp 发布模式上不显示 OxyPlot 图形
问题描述
我创建了一个使用 oxyplot 和Rg.Plugins.Popup
xamarin 表单的 xamarin 表单项目。但是,该图表无法正常工作。我修改了代码参考链接,但 UWP 上没有显示图表。
另外,我初始化Rg.Plugins.Popup
并 oxyplot
使用以下代码,我不知道我做错了什么。请帮忙。提前致谢。
在 UWP 项目 App.xaml.cs
Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());
List<Assembly> assembliesToInclude = new List<Assembly>();
//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof(OxyPlot.PlotModel).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.PlotController).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Windows.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer).GetTypeInfo().Assembly);
try
{
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
}
catch (Exception ex) { }
OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init();
Xamarin 形式和 oxyplot 版本是
OxyPlot.Xamarin.Forms:1.1.0-unstable0011
Xamarin.Forms:4.2.0.709249
解决方案
如果你想同时使用它们,你可以将它们的程序集插入到同一个列表中。更多内容请参考以下内容。
List<Assembly> assembliesToInclude = new List<Assembly>();
Popup.Init();
OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init();
assembliesToInclude.Add(typeof(OxyPlot.PlotModel).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.PlotController).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Windows.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.PlotView).GetTypeInfo().Assembly);
assembliesToInclude.Add(typeof(OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer).GetTypeInfo().Assembly);
var assemblies = Popup.GetExtraAssemblies();
assembliesToInclude.AddRange(assemblies);
var count = assembliesToInclude.Count;
try
{
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
}
catch (Exception ex) {
}
推荐阅读
- angular - 更改检测后角度视图不更新
- php - 如果 PHP 中的键值相等,则从数组中分组项目
- solr - 是否可以在 WCS 中将通配符与 SOLR 查询字段(qf)一起使用?
- mysql - DATEDIFF 和自己做减法有什么区别
- json - MarkLogic json:transform-from-json 有多个命名空间?
- javascript - 如何编写异步?
- arrays - 有没有办法循环遍历一个圆圈数组,这样我就可以确定哪些圆圈重叠并改变颜色
- python - 使用基本身份验证的 Python jira 401 可恢复错误
- python-3.x - 如何使用 argparse.REMAINDER 选项在一个字符串中获取所有剩余参数?
- rust - 回归自我以避免搬出借用内容