【发布时间】:2013-12-31 16:20:46
【问题描述】:
我对 WPF 很陌生,正在使用 WPF 构建图表应用程序。我正在动态添加新行,并且效果很好。删除行时出现问题。这是我添加行的代码
RowDefinition newRow = new RowDefinition();
newRow.Name = "ADX";
newRow.Height = new GridLength(1, GridUnitType.Star);
this.chartForm.sciChartControl.ContentGrid.RowDefinitions.Add(newRow);
Grid.SetRow(scs, this.chartForm.sciChartControl.ContentGrid.RowDefinitions.Count - 1);
this.techIndicatorToRowDefinitionMap["ADX"] = newRow;
删除行的代码是
this.chartForm.sciChartControl.ContentGrid.RowDefinitions.Remove(this.techIndicatorToRowDefinitionMap["ADX"]);
当我删除 rows 时,似乎随机行被删除了。你能告诉我是否有更简单的方法来跟踪行并删除它们,或者这段代码中是否存在错误。
谢谢。
【问题讨论】: