i modify the sample of [https://github.com/DevExpress-Examples/wpf-charts-create-chart-elements-from-view-model], and add a delete button,
when click , will remove some items in the background like (in chartDemo\CS\ dictionary):
Codeprivate void itemDelete_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
{
if(DataContext is MainViewModel vm)
{
vm.Chart.Series.RemoveAt(0);
vm.Chart.Panes.RemoveAt(0);
vm.Chart.YAxes.RemoveAt(0);
vm.Chart.Legends.RemoveAt(0);
}
}
It does work, but the output prints some binding exception information(as shown below). How can I eliminate these binding exceptions?
System.Windows.Data Error: 40 : BindingExpression path error: 'ShowXAxis' property not found on 'object' ''MainViewModel' (HashCode=13213278)'. BindingExpression:Path=ShowXAxis; DataItem='MainViewModel' (HashCode=13213278); target element is 'ScrollBarOptions' (HashCode=51692872); target property is 'Visible' (type 'Boolean')
System.Windows.Data Error: 40 : BindingExpression path error: 'Title' property not found on 'object' ''MainViewModel' (HashCode=13213278)'. BindingExpression:Path=Title; DataItem='MainViewModel' (HashCode=13213278); target element is 'AxisTitle' (Name=''); target property is 'Content' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'ConstantLines' property not found on 'object' ''MainViewModel' (HashCode=13213278)'. BindingExpression:Path=ConstantLines; DataItem='MainViewModel' (HashCode=13213278); target element is 'SecondaryAxisY2D' (Name=''); target property is 'ConstantLineInFrontItemsSource' (type 'IEnumerable')
System.Windows.Data Error: 40 : BindingExpression path error: 'DockTarget' property not found on 'object' ''MainViewModel' (HashCode=13213278)'. BindingExpression:Path=DockTarget; DataItem='MainViewModel' (HashCode=13213278); target element is 'Legend' (Name=''); target property is 'DockTarget' (type 'Object')