This question is locked. New answers and comments are not allowed.
Hello,
I make a small project the demonstrate a possible issue: If i try to add more than one CustomGridLine with custom style is no longer working for the second, third,.... CustomGridLine added
Is there a posibility to have more than one CustomGridLine with custom style?
The xaml file:
The model:
using System.Collections.Generic;
The same behaviour if you use CustomLine instead of CustomGridLine!
Thank You!
I make a small project the demonstrate a possible issue: If i try to add more than one CustomGridLine with custom style is no longer working for the second, third,.... CustomGridLine added
Is there a posibility to have more than one CustomGridLine with custom style?
The xaml file:
<
UserControl
x:Class
=
"Telerik.Windows.Examples.Chart.Gallery.StackedSpline.Example"
xmlns:vm
=
"clr-namespace:Telerik.Windows.Examples.Chart.Gallery.ViewModel"
xmlns:telerikQuickStart
=
"clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
xmlns:chart
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
xmlns:charting
=
"clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
>
<
UserControl.DataContext
>
<
vm:UserDataViewModel
ItemsCount
=
"8"
SeriesCount
=
"2"
/>
</
UserControl.DataContext
>
<
UserControl.Resources
>
<
Style
x:Key
=
"CustomGridLineStyle"
TargetType
=
"Line"
>
<
Setter
Property
=
"StrokeDashArray"
Value
=
"1,1"
/>
</
Style
>
</
UserControl.Resources
>
<
Border
telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled
=
"True"
>
<
chart:RadChart
x:Name
=
"RadChart1"
ItemsSource
=
"{Binding CollectionData}"
>
<
chart:RadChart.SeriesMappings
>
<
charting:SeriesMapping
LegendLabel
=
"Stacked Spline 1"
CollectionIndex
=
"0"
>
<
charting:SeriesMapping.SeriesDefinition
>
<
charting:StackedSplineSeriesDefinition
/>
</
charting:SeriesMapping.SeriesDefinition
>
<
charting:ItemMapping
DataPointMember
=
"YValue"
/>
</
charting:SeriesMapping
>
<
charting:SeriesMapping
LegendLabel
=
"Stacked Spline 2"
CollectionIndex
=
"1"
>
<
charting:SeriesMapping.SeriesDefinition
>
<
charting:StackedSplineSeriesDefinition
/>
</
charting:SeriesMapping.SeriesDefinition
>
<
charting:ItemMapping
DataPointMember
=
"YValue"
/>
</
charting:SeriesMapping
>
</
chart:RadChart.SeriesMappings
>
<
chart:RadChart.DefaultView
>
<
charting:ChartDefaultView
>
<
charting:ChartDefaultView.ChartArea
>
<
charting:ChartArea
>
<
charting:ChartArea.Annotations
>
<
charting:CustomGridLine
YIntercept
=
"3"
Stroke
=
"Red"
StrokeThickness
=
"2"
ElementStyle
=
"{StaticResource CustomGridLineStyle}"
/>
<
charting:CustomGridLine
YIntercept
=
"4"
Stroke
=
"Red"
StrokeThickness
=
"2"
ElementStyle
=
"{StaticResource CustomGridLineStyle}"
/>
</
charting:ChartArea.Annotations
>
</
charting:ChartArea
>
</
charting:ChartDefaultView.ChartArea
>
<
charting:ChartDefaultView.ChartLegend
>
<
charting:ChartLegend
Name
=
"legend"
ReverseLegendItemsOrder
=
"True"
/>
</
charting:ChartDefaultView.ChartLegend
>
</
charting:ChartDefaultView
>
</
chart:RadChart.DefaultView
>
</
chart:RadChart
>
</
Border
>
</
UserControl
>
The model:
using System.Collections.Generic;
namespace Telerik.Windows.Examples.Chart.Gallery.ViewModel
{
public class UserDataViewModel
{
private IList<
IEnumerable
<double>> _data;
private int _itemsCount;
private int _seriesCount;
public IList<
IEnumerable
<double>> CollectionData
{
get
{
if (this._data == null)
{
this._data = this.FillSampleChartData();
}
return this._data;
}
}
public IEnumerable<
double
> Data
{
get
{
return this.CollectionData[0];
}
}
public int ItemsCount
{
get
{
return _itemsCount;
}
set
{
_itemsCount = value;
}
}
public int SeriesCount
{
get
{
return _seriesCount;
}
set
{
_seriesCount = value;
}
}
protected virtual IList<
IEnumerable
<double>> FillSampleChartData()
{
List<
IEnumerable
<double>> itemsSource = new List<
IEnumerable
<double>>();
itemsSource.Add(new List<
double
>(){1,2,3,});
itemsSource.Add(new List<
double
>() { 2, 4, 6});
itemsSource.Add(new List<
double
>() { 1, 3, 5 });
return itemsSource;
}
}
}
The same behaviour if you use CustomLine instead of CustomGridLine!
Thank You!