简体   繁体   中英

Need to show usercontrol on the top in WPF

I have a user control that I am using for some purpose and it's movable on the screen. Actually I am creating an application using Leap Motion. SO wherever I move my figure on the screen a big circular cursor moves accordingly. But on some place it gets cut off or I would say it gets hide or overlapped due to some other controls. So I want to know, how can I placed it on the top of the mainwindow view. Is it possible using adorner layer? If yes, So can you please tell me how to do that in WPF?

I found few examples on net but they are creating a rectangle or some thing on adorner layer using drwaingcontext object, however I just need to show my user control on the top.

Please give me some idea

Thanks & Regards, Vinod

You shouldn't need to use the Adorner layer to simply show a UserControl on top of other controls... of course that depends on exactly what is 'overlapping' or hiding it. If they are just other UI controls, then you can fix your problem in two ways.

The first is to simply declare your UserControl that you want to be on top of the other controls at the bottom of the XAML, eg. define that element last.

The second solution is to use the Panel.ZIndex Attached Property to place that element above all others:

<UserControl Panel.ZIndex="10" />

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