C# 创建CustomRenderableSereisViewModel-设置属性
这可能与以下人员有关: 我想参考SciChart示例包中的“样条散点线图”示例。如果我要使其成为一个可在ViewModel类中设置的CustomRenderableSeriesViewModel,我将如何进行设置 我正在使用SciChart v4,以下是我目前所知道的:C# 创建CustomRenderableSereisViewModel-设置属性,c#,wpf,scichart,C#,Wpf,Scichart,这可能与以下人员有关: 我想参考SciChart示例包中的“样条散点线图”示例。如果我要使其成为一个可在ViewModel类中设置的CustomRenderableSeriesViewModel,我将如何进行设置 我正在使用SciChart v4,以下是我目前所知道的: CustomRenderableSeriesViewModel:BaseRenderableSeriesViewModel ViewType=typeof(CustomRenderableSeries) 到目前为止,我的代码是:
public class CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
{
public override Type ViewType => typeof(CustomRenderableSeries);
}
如何通过CustomRenderableSeriesViewModel类设置CustomRenderableSeries的IsSplineEnabled属性
仅供参考:我已经查看了,链接指向SciChart v5用户手册
您能提供建议吗?尝试将属性添加到
CustomRenderableSeriesViewModel
类:
public class CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
{
public override Type ViewType => typeof(CustomRenderableSeries);
private bool _isSplineEnabled;
public bool IsSplineEnabled
{
get { return _isSplineEnabled; }
set { SetValue(ref _isSplineEnabled, value, "IsSplineEnabled"); }
}
}
…并将其绑定到样式为的CustomRenderableSeries
的属性:
<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
<Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>
<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
<Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>
…并将其绑定到样式中CustomRenderableSeries的属性:
<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
<Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>
<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
<Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>
鉴于SciChart.com上的以下开放线程,尚不清楚这是否真的有效:
如果失败了,我建议你在那里发布新的评论,等待官方支持团队回复你。SciChart声称“以卓越的技术支持而自豪,并希望您能够快速解决您的请求”,因此您不需要很长时间就能从@Dr.ABT或其团队成员那里得到答案。为您的viewmodel提供一个名为
EnableSpline
的布尔属性。确保它能正确地执行INPC操作。在样式中,请尝试
。我猜您正在创建的viewmodel应该是该系列的DataContext,但这只是一个猜测。如果失败,请更改为Value=“{Binding EnableSpline,PresentationTraceSources.TraceLevel=High}”,并在运行时查看VS输出窗格进行诊断。