Add child to specific location in tree
Posted: 22 Dec 2018, 04:54
I can add a new element to a Canvas using canvas.Children.Add()
But how do I place that element above or below an existing element in the xaml tree?
Is this the way it is supposed to be done?
But how do I place that element above or below an existing element in the xaml tree?
Is this the way it is supposed to be done?
Code: Select all
int index = canvas.Children.IndexOf(existingElement);
canvas.Children.Insert(index + 1, newElement);