How do I create Windows with WPF that look like notification area windows in Windows 7?
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, 开发者_JAVA百科yet.
Thanks for any help!
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.
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.
精彩评论