I write a code. The code is place in the Menu two controls.
When the Indicator terminate I write some code
else if(State == State.Terminated)
{
this.Dispatcher.InvokeAsync ((Action)(() =>
{
chartWindow.MainMenu.Remove(btnRectangle);
btnRectangle.Click -= btnRectangle_Click;
btnRectangle = null;
}));
this.Dispatcher.InvokeAsync((Action)(() =>
{
if (myGrid != null)
{
if (comboBox != null)
{
myGrid.Children.Remove(comboBox);
comboBox.SelectionChanged -= MyHandlar;
comboBox = null;
}
}
}));
chartWindow.MainTabControl.SelectionChanged -= MySelectionChangedHandler;
chartWindow = null;
}
But the controls, not removed. Why not remove a Controls?
Thank You Very Much.
Comment