Wouter
Wouter

Reputation: 2262

Is there a way to change the draw order in WPF

Is there a way to change the draw order of Controls in a StackPanel without changing the actual ordering of these controls in the StackPanel?

The reason I ask is that we have a button bar with margin 0 between the buttons. The active button grows (ie margin set to -10) overlapping the neighbouring buttons. The problem here is that the right button is drawn later and thus is drawn on top instead of the active button.

I'm afraid I will need to make a custom control that is grid based..

Upvotes: 7

Views: 3460

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564333

Instead of changing the draw order, just set the Panel.ZIndex attached property.

Upvotes: 11

Related Questions