How do you bring to front a usercontrol added to a canvas in code behind

user38349 picture user38349 · Feb 4, 2009 · Viewed 8.6k times · Source

I have a series of usercontrols that are added and removed from a canvas in code behind. I need to insure that certain ones are forward of others. How do you set, what used to be the ZOrder in VB6, the order of a user control once it is added to a canvas?

Answer

Bubblewrap picture Bubblewrap · Feb 4, 2009

EDIT: Eh, apologies...you'll have to translate this to VB.Net code...as i only code in C# with WPF

Canvas.SetZIndex(control, zIndex);

Canvas.SetZIndex()

And more info about canvas and the z-index: Canvas.ZIndex Attached Property