Approved
Last Updated: 22 Jul 2019 08:16 by ADMIN
Martin Ivanov
Created on: 22 Jul 2019 08:10
Category: ChartView
Type: Bug Report
1
ChartView: NullReferenceException in design-time when the Palette property is set in XAML

When you set the Palette property to a new instance of ChartPalette in XAML, a NullReferenceException is thrown. This happens when you click inside the chart control in the Visual Studio designer.

The exception reproduces only if the "Miscellaneous" category in the "Properties" pane of Visual Studio is expanded.

To work this around, set the Palette property in code:

C#:

public MainWindow()
{
    InitializeComponent();
    this.chart.Palette = (ChartPalette)this.Resources("cpBarChart");
}

VB.NET:
Sub New()
    InitializeComponent()
    Me.chart.Palette = DirectCast(Me.Resources("cpBarChart"), ChartPalette)
End Sub

 

 

0 comments