tags:

views:

1175

answers:

6
A: 

I don't know much about WPF myself, but is the Panel.ZIndex attached property what you're after, perhaps?

Jon Skeet
A: 

Not sure exactly what you are trying to accomplish but from my brief encounters with WPF, it seems like maybe you might accomplish what you need with the proper configuration of a parent\child relationship between your two windows. I recently so a basic 'hello, world' on Dr. Dobb's portal that may give you some direction.

Here's the link to the training tutorial video -- Dr. Dobb's TV you will just need to select the "Build a Standard WPF Application' video from the list...

Fender
+1  A: 

Placing two elements into the same row/column in a Grid simply overlays them. You can then use the Visibility on each element to show/hide them. So for example:

<Grid>
    ... row/column definitions
    <Grid Grid.Row="0" Grid.Column="0">
        ... main content here
    </Grid>
    <Grid Grid.Row="0" Grid.Column="0" x:Name="grid2">
        ... overlaid content here
    </Grid>
</Grid>

Now the overlaid content will appear over the top of the main content content. Setting grid2.Visibility to Visible/Hidden will show/hide your overlaid content.

Matt Hamilton
A: 

You could achieve a similar effect by overlaying things in a grid (things just stack on top of each other if they're in the same cell), but my spider sense would tell me that that is just another window defined something like:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SubWindow" Height="100" Width="100" WindowStyle="None" AllowsTransparency="True" Opacity="0.5"  >

You could then show it in you main window by doing something like:

SubWindow sw = new SubWindow ();
sw.DoModal();
Steven Robbins
+1  A: 

I can think of two ways to achieve this effect (non rectangular semi transparent overlay on top of a window that extends behind the window's bounds).

First option, DON'T USE THIS IN PRODUCTION CODE (AllowTransparency is slow and very buggy) - Make the window larger then the actual content, set AllowsTransaprencey="True" so that the area "outside" of the window is transparent, now all you have to do for the popup is to add another visual in the same container as the "window" .

Second option, use a Popup, you will have to position your popup carefully, call SetWindowRgn via interop to make it non rectangular and call the Win32 API function that sets transparency value (sorry, don't remember the name at the moment) to make it semi-transparent.

The first option is easy to implement and will look better then the second option, but it's slower and you will run into all sorts of weird bugs (including crushes with some display drivers) - I know this from experience, when I switched the software I'm selling from AllowTransparency to SetWindowRgn 90% of the crush reports disappeared.

The second options requires a lot of native Win32 API calls but it should work.

Nir
A: 

you can use adorner layer to overlay . It's basically a rendering surface that overlays any adorned element.

Crippeoblade