简体   繁体   中英

Can't set ZIndex in WPF

I have xaml code like this: 在此处输入图片说明

Now what I want is: keep Height of The Black Grid , then set Height of The Red WrapPanel to 200 , but The Red WrapPanel is limited by The Black Grid . This will be like this: 在此处输入图片说明 So how can I display full The Red WrapPanel ? (Condition: Always keep Height of The Black Grid , it's not allowed to resize or do anything) I was tried with Canvas.ZIndex but still doesn't work. Thank you all!

You can achieve this using negative margins. like so:

<WrapPanel Background="Red" Height="200" Margin="0 0 0 -100"/>

Hope this help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM