Specified element is already the logical child of another
Hello, can anyone help?
I get this error "Specified element is already the logical child of another element. Disconnect it first." form this code
Code Snippet
txtPhaseNo.Text = customImage[i].PhaseNo.ToString();
txtPhaseNo.Foreground = System.Windows.Media.Brushes.Red;
txtPhaseNo.HorizontalAlignment = HorizontalAlignment.Center;
txtPhaseNo.VerticalAlignment = VerticalAlignment.Center;
grid.Children.Add(txtPhaseNo);
grid.Children.Add(customImage[i]);
containerCanvas.Children.Add(grid);