Exception Thrown Attempting to Set StrokeDashArray on CartesianChartGrid
Environment
Product Version | 2019.2 902 |
Product | RadChartView for WPF |
Description
InvalidOperationException is thrown when setting the StrokeDashArray property of the CartesianChartGrid lines through the MajorXLineStyle or MajorYLineStyle properties.
The error message is: "Specified value of type 'System.Windows.Media.DoubleCollection' must have IsFrozen set to false to modify."
Solution
Instead of the StrokeDashArray property of the Line element, set the MajorXLineDashArray and MajorYLineDashArray properties of the CartesianChartGrid element.
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorXLineDashArray="4,2" MajorYLineDashArray="4,2" >
</telerik:RadCartesianChart.Grid>