Pre loader

StrokeDashArray Binding Not Working for FastLineRenderableSeries / GridLineStyle

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I am trying to bind StrokeDashArray to a property in my ViewModel, which is an enum (Solid, Dash, Dot), using a value converter.

The binding works as expected for HorizontalLineAnnotation, but it does not work for FastLineRenderableSeries or MajorGridLineStyle.

Works

<s:HorizontalLineAnnotation StrokeDashArray="{Binding LineStyle, Converter={StaticResource DashConverter}}" />
<s:FastLineRenderableSeries StrokeDashArray="4,4" />

Does NOT work, always display solid line

<s:FastLineRenderableSeries StrokeDashArray="{Binding LineStyle, Converter={StaticResource DashConverter}}" />

Converter Code

public enum LineStyle { Solid, Dash, Dot }

public class DashConverter : IValueConverter
{
   public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
   {
      Enum.TryParse(value.ToString(), out LineStyle lineStyle);
      switch (lineStyle)
      {
         case LineStyle.Dash:
            return new DoubleCollection(new double[] { 4, 4 });
         case LineStyle.Dot:
            return new DoubleCollection(new double[] { 1, 4 });
      }
   return new DoubleCollection();//Solid
}
Version
8.6.0.28199
  • Lex
    Hi Rachel, Thanks for your inquiry. Unfortunately, it looks like the “Works” and “Does NOT work” sections of your message miss additional details. Could you please resend them? Thanks in advance, Lex, SciChart Technical Support Engineer
  • You must to post comments
0
0

Hi Rachel,

I hope this message finds you well.
Thank you for reporting this.

There are currently different types of StrokeDashArray properties (please see the attached image).
We plan to fix this in the future SciChart releases.

For now, we recommend using the customized converter, which will check the targetType.
We’ve prepared a sample project featuring the mentioned converter for your convenience. Please find it attached.

Kind regards,
Lex,
SciChart Technical Support Engineer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.