Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Binding to TrendLineBrushProperty doesn't work
posted

Hi,

I'm working in MVVM architecture, so I use SeriesBinderInfo class (I found an example in the forum).

All bindings work fine except from TrendLineBrushProperty , the series get some default brush and not the one that it is bind to. What do I miss ?

Here is the relevant code from SeriesBinderInfo :

HorizontalAnchoredCategorySeries category = series as HorizontalAnchoredCategorySeries;

category.ClearValue(HorizontalAnchoredCategorySeries.ValueMemberPathProperty);

category.ClearValue(HorizontalAnchoredCategorySeries.ItemsSourceProperty);

category.SetValue(MarkerSeries.MarkerTypeProperty, MarkerType.None);

if (!clearOnly)

{

category.SetBinding(HorizontalAnchoredCategorySeries.ValueMemberPathProperty,

new Binding(YMemberPath) { Source = seriesSource });

category.SetBinding(HorizontalAnchoredCategorySeries.ItemsSourceProperty,

new Binding(ItemsSourcePath) { Source = seriesSource });

category.SetBinding(HorizontalAnchoredCategorySeries.VisibilityProperty,

new Binding("IsVisible") { Source = seriesSource, Converter = new BoolToVisibilityConverter()});

category.SetBinding(HorizontalAnchoredCategorySeries.TrendLineBrushProperty,

new Binding("SeriesBrush") { Source = seriesSource });

}

if (shouldRenewAxes)

{

if (category.XAxis != null)

_owner.Axes.Remove(category.XAxis);

if (category.YAxis != null)

_owner.Axes.Remove(category.YAxis);

if (!clearOnly)

{

if (_xAxis == null)

{

_xAxis = new CategoryXAxis();

_xAxis.SetBinding(CategoryXAxis.ItemsSourceProperty,

new Binding(ItemsSourcePath) { Source = seriesSource });

_xAxis.Label = "{" + seriesSource.GetType().GetProperty(XMemberPath).GetValue(seriesSource, null) + ":H:mm:ss:fff" + "}";

_yAxis = new NumericYAxis();

_owner.Axes.Add(_xAxis);

_owner.Axes.Add(_yAxis);

}

 

 

category.XAxis = _xAxis;

category.YAxis = _yAxis;

}

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Dudi,

    Thank you for your post.

    I have been investigating into this issue, and I am currently under the impression that you are likely mistaking the TrendLineBrush property for the Brush property of your series. The TrendLineBrush property is not meant to color your series, but if you set a value for the TrendLineType property of your series, you will see a best-fit line drawn. This line's fit will be based on the formula type that you choose for the TrendLineType property of your series. I would expect that it would be very likely that this trend-line's color would directly reflect your TrendLineBrush property that you are setting here. To color your actual, plotted series, I would recommend that you use the Brush property rather than the TrendLineBrush property here.

    Please let me know if you have any other questions or concerns on this matter, or whether my above impression on this matter is incorrect.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

Children
No Data