I am pretty new to WPF and am building an Charting application using WPF. I am adding new rows dynamically and it works perfectly. I am seeing a problem when removing rows. This is my code for adding rows
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;
and the code to remove the Row is
this.chartForm.sciChartControl.ContentGrid.RowDefinitions.Remove(this.techIndicatorToRowDefinitionMap["ADX"]);
When I remove the rows , it seems like random rows are removed. Can you tell me if there is an easier way to keep track of rows and delete them or if there is a bug in this code .
Thanks.
Hi I think your code is Removeing the RowDefinition correctly but what I think wrong is you also need to remove the children of Grid in that Row like
If you wont remove the child the RowDefinition will be removed but child will be shifted to another row .I hope this will give you an idea.