Xamarin NetStandard Android sfChart DateTimeStripLine 未显示?
Xamarin NetStandard Android sfChart DateTimeStripLine not displayed?
这是相当具体的(如标题所示)。
我最近将我的 Xamarin Forms 应用移植到 NETStandard,现在我的 sfChart DateTimeStripLine 在 Android.
上不可见
在 UWP 上 more-or-less 一切正常,所以我认为我没有引入回归。
有没有人有类似的经历?有人在 NET Standard 上成功使用过 ChartStripLine 吗?
我们已经使用 SfChart 中的 DateTimeStripline 和 .Net Standard 1.3 准备了一个示例,它在 sample 中运行良好。如果仍然遇到问题,请提供Stripline相关代码片段,这将有助于提供更好的解决方案。
所以,终于弄清楚了问题所在:
在 XAML 中声明的 StripLines 工作正常,但绑定到 StripLineCollection 没有(仅 android)。不幸的是,在 XAML 中声明并不是一个特别有用的选项。
到fix/workaround,像这样在XAML中声明带状线:
<chart:DateTimeAxis x:Name="TheTimeAxis" ...>
<chart:DateTimeAxis.StripLines>
<!-- Empty def requires at least one item to be used
This creates container to fill in ViewModel.
Fixes dissappearing StripLines bug on android -->
<chart:DateTimeStripLine WidthType="Day" Width ="1"
Start="09/28/2017">
</chart:DateTimeStripLine >
</chart:DateTimeAxis.StripLines>
然后,在后面的代码中访问命名轴,拉出带状线并修改您的心意。
// Workaround Android: Our StripLines do not appear to be
// refreshing when bound from XAML. To fix we create in XAML,
// then retrieve the existing collection and pass that to the
// viewmodel for modification
DateTimeAxis sl = this.TheTimeAxis;
var slc = sl.StripLines;
这是相当具体的(如标题所示)。
我最近将我的 Xamarin Forms 应用移植到 NETStandard,现在我的 sfChart DateTimeStripLine 在 Android.
上不可见在 UWP 上 more-or-less 一切正常,所以我认为我没有引入回归。
有没有人有类似的经历?有人在 NET Standard 上成功使用过 ChartStripLine 吗?
我们已经使用 SfChart 中的 DateTimeStripline 和 .Net Standard 1.3 准备了一个示例,它在 sample 中运行良好。如果仍然遇到问题,请提供Stripline相关代码片段,这将有助于提供更好的解决方案。
所以,终于弄清楚了问题所在:
在 XAML 中声明的 StripLines 工作正常,但绑定到 StripLineCollection 没有(仅 android)。不幸的是,在 XAML 中声明并不是一个特别有用的选项。
到fix/workaround,像这样在XAML中声明带状线:
<chart:DateTimeAxis x:Name="TheTimeAxis" ...>
<chart:DateTimeAxis.StripLines>
<!-- Empty def requires at least one item to be used
This creates container to fill in ViewModel.
Fixes dissappearing StripLines bug on android -->
<chart:DateTimeStripLine WidthType="Day" Width ="1"
Start="09/28/2017">
</chart:DateTimeStripLine >
</chart:DateTimeAxis.StripLines>
然后,在后面的代码中访问命名轴,拉出带状线并修改您的心意。
// Workaround Android: Our StripLines do not appear to be
// refreshing when bound from XAML. To fix we create in XAML,
// then retrieve the existing collection and pass that to the
// viewmodel for modification
DateTimeAxis sl = this.TheTimeAxis;
var slc = sl.StripLines;