views:

58

answers:

2

Is there a way to create windows like the native Windows 7 notification area Windows with Windows Presentation Foundation? For example the audio controls or the power plan settings.

I was able to create a Window with Windows Forms that was looking equal, but still had the resize cursor when you hovered the borders. I’m using the following code:

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True"
        DataContext="{Binding}" WindowStyle="SingleBorderWindow"
        WindowStartupLocation="Manual" ShowActivated="False"
        IsManipulationEnabled="False" mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        d:DesignHeight="218" d:DesignWidth="368" SizeToContent="WidthAndHeight">
    <Grid>

    </Grid>
</Window>

My problem is that I’m not able to remove the title bar and close button completely. Or is there a library available for creating such windows?

I wanted to post screenshots, but I wasn’t able since I don’t have 10 reputation points, yet.

Thanks for any help!

+1  A: 

You can't do that with WPF only. You need to do some Win32 interop and remove the WS_CAPTION and WS_SYSMENU styles from your window.

Here's my answer to a similar SO question that has some sample code on how to manipulate the window style and extended style.

Franci Penov
+1  A: 

You can make your window look like anything you want. Set WindowStyle to None and AllowsTransparency to true in addition to what you've got already. You can then apply your own ControlTemplate to Window and make it look like anything you can find, including partial transparency and weird shapes.

John Bowen
While this is true, there are known limitations with resizing, non-client area and maximized windows when using `WindowStyle=None`. A little bit of Win32 interop is still required to make such windows behave exactly as they should.
Franci Penov
How often do you resize and maximize notification windows?
John Bowen