New to Telerik UI for WPF? Start a free 30-day trial
Exception Thrown Attempting to Set StrokeDashArray on CartesianChartGrid
Updated on Sep 15, 2025
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.
XAML
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorXLineDashArray="4,2" MajorYLineDashArray="4,2" >
</telerik:RadCartesianChart.Grid>