Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make overlay control above all other controls?

I need to make a control appear above all other controls, so it will partially overlay them.

like image 547
user626528 Avatar asked Oct 22 '22 17:10

user626528


People also ask

How to create an overlay effect?

Learn how to create an overlay effect: Overlay Click anywhere to turn off the overlay effect Turn on the overlay effect How To Create an Overlay Effect Step 1) Add HTML: Use any element and place it anywhere inside the document: Example <div id="overlay"></div> Step 2) Add CSS: Style the overlay element: Example #overlay {

How do I put one control on top of another?

So a simple way to put one control on top of another is to put it in the same cell. Here's a useful example, which pops up a panel that disables everything in the view (i.e. the user control) with a busy message while a long-running task is executed (i.e. while the BusyMessage bound property isn't null):

Do adorners appear above or below the other controls?

Adorners typically appear above all other controls, but the other answers that mention z-order may fit your case better. Show activity on this post. <Canvas Panel.ZIndex="1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="570"> <!--


1 Answers

If you are using a Canvas or Grid in your layout, give the control to be put on top a higher ZIndex.

From MSDN:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowTitle="ZIndex Sample">
  <Canvas>
    <Rectangle Canvas.ZIndex="3" Width="100" Height="100" Canvas.Top="100" Canvas.Left="100" Fill="blue"/>
    <Rectangle Canvas.ZIndex="1" Width="100" Height="100" Canvas.Top="150" Canvas.Left="150" Fill="yellow"/>
    <Rectangle Canvas.ZIndex="2" Width="100" Height="100" Canvas.Top="200" Canvas.Left="200" Fill="green"/>

    <!-- Reverse the order to illustrate z-index property -->

    <Rectangle Canvas.ZIndex="1" Width="100" Height="100" Canvas.Top="300" Canvas.Left="200" Fill="green"/>
    <Rectangle Canvas.ZIndex="3" Width="100" Height="100" Canvas.Top="350" Canvas.Left="150" Fill="yellow"/>
    <Rectangle Canvas.ZIndex="2" Width="100" Height="100" Canvas.Top="400" Canvas.Left="100" Fill="blue"/>
  </Canvas>
</Page>

If you don't specify ZIndex, the children of a panel are rendered in the order they are specified (i.e. last one on top).

If you are looking to do something more complicated, you can look at how ChildWindow is implemented in Silverlight. It overlays a semitransparent background and popup over your entire RootVisual.

like image 188
foson Avatar answered Oct 24 '22 07:10

foson