views:

459

answers:

1

Is there a way to have controls/images/etc "out of" the Window/Chrome (ie, Aero's glass) in WPF?

An example of what I mean is the WPF Yahoo Messenger which was released (and then discontinued) awhile back. The WindowStyle looks like it is set to None, but AllowTransparencies/CanResize set to false/true respectively - and the avatar is slightly "out of the window/chrome".

I know I could create my own glass border, but that may be a fair bit of effort to get it looking consistent.

+3  A: 

Yes, I believe you will have to replace window's interface with your own. You can start with transparent window and a grid within leaving some margin around the grid. Then put thumbs, titlebar etc on the grid to simulate window behavior. Margin around the grid will allow you to draw controls outside your "window".

<Window
x:Class="TransparentFormDemo.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300"
AllowsTransparency="True"
WindowStyle="None" Background="Transparent">
<Grid Margin="20" Background="AliceBlue">
    <Thumb Name="topThumb" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Top"
           DragDelta="topThumb_DragDelta" Cursor="SizeNS"/>
    <!--Thumbs continued-->
    <Polygon Points="10,110 60,10 110,110" Fill="Blue" Margin="0,-30"/>
</Grid>
</Window>
Stanislav Kniazev
Nuts, I was hoping to retain/respect the window chrome regardless of the OS version, but there wouldn't be a way to do that using that method.
aeoth
Yep, you will lose standard windows themes and I don't think you can draw something outside of window control. Another way to do this is to draw an avatar on completely separate transparent window and stick this window somehow on top of main one so it looks as one single control. It looks doable, but not in pure WPF, you will need at least some PInvoke calls.
Stanislav Kniazev