private static void sendFront(FrameworkElement element, ElementGroup group) { group.Elements.Remove(element); group.Elements.AddFirst(element); applyZOrdering(group); }
internal static void Attach(FrameworkElement element, ElementGroup group) { group.Elements.AddFirst(element); element.MouseDown += (sender, args) => sendFront(element, group); applyZOrdering(group); }
private static void applyZOrdering(ElementGroup group) { var currentIndex = 0; foreach (var element in group.Elements) { --currentIndex; Panel.SetZIndex(element, currentIndex); } }