Vinod Bhatt
Vinod Bhatt

Reputation: 761

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

Upvotes: 1

Views: 3253

Answers (1)

Sheridan
Sheridan

Reputation: 69987

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" />

Upvotes: 2

Related Questions