Click here to Skip to main content
15,038,345 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, can someone help me to make a Custom WPF window style with all windows effects(I think it is called DWM effects) without the Aero border (and includes Form Shadow, Dock by cursor, system resize not using mouse_down and mouse_move events, starting/closing animation that is done by windows Aero Effects, the cursor cannot cross the Taskbar when holding the form(moving) and so on) I already done it in win form app absolutely the same theme of Office 2013 with all effects that I mentioned.
Posted

I mostly answered in my previous answer, please see: How to speed up my vb.net application?[^].

I only want to add about Windows effects and Aero. These effects does not belong to your system, but to the OS and this is the user who defines which ones are used. Your application cannot get rid of most of them.

However, if you want, you can get rid of Aero. More exactly, you can deny playing in Windows games with everything which lies inside your window border. It is more or less clear how to do it in your client area of your windows, but how to do with the non-client area, which includes title bar and the borders. It may makes sense, to create your own style, fully independent on Windows settings.

Here is my prescription for that: get rid of non-client areas at all! Here is how: set its property WindowStyle to System.Windows.WindowStyle.None:
http://msdn.microsoft.com/en-us/library/system.windows.window.windowstyle.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.windowstyle.aspx[^].

It will remove non-client areas completely. But you should understand that you will loose the application icon and its menu, title bar and the ability to drag a window, all buttons: no minimize/maximize/restore, etc. You will need to simulate it all by you own controls. But this time, fully custom. Well, come to think about, you asked for it. :-)

Yes, I read about DWM effect, but it is what it is…

Good luck,
—SA
   
v2
Comments
Boudi AlSayed 7-Jan-13 22:08pm
   
You are the Best :)
   
Well, thank you for your nice (but flattering, without enough grounds :-) words.
Well then, are you thinking to accept this answer, as well as some of the previous ones? :-)
—SA
Boudi AlSayed 7-Jan-13 22:32pm
   
Nope not that what I meant. please see my project : http://www.mediafire.com/?66alplm534bey44
   
OK, whatever. Sorry if it's not that. I cannot see what do you mean by that site. Initially, your question was about WPF...
—SA
Boudi AlSayed 8-Jan-13 9:40am
   
thanks I've found what I want and posted the answer to help others :)
To really take control of window styles in WPF, you need to set the style to 'none' and then draw your own. Once you've done that, you can draw anything you like.
   
Comments
Boudi AlSayed 7-Jan-13 22:01pm
   
Of course I know but when you set the style to 'none' no DWN effects will be available, I think that you didn't read the question just the title :)
Christian Graus 7-Jan-13 22:03pm
   
You have to write them yourself. You are right, you lose all that, because you took responsibility for it. If the standard frame does not suit you, then you have no choice.
Hey I've found the solution :

first : Download the WPF Shell Integration Library Here[^]
then use this XML Code :

XML
<Window x:Class="MyLibrary.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
        Title="MainWindow"
        WindowStyle="SingleBorderWindow"
        ResizeMode="CanResizeWithGrip"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        d:DesignHeight="449"
        d:DesignWidth="677"
        Foreground="White"
        removed="Black">

    <shell:WindowChrome.WindowChrome>
        <shell:WindowChrome CaptionHeight="35"
                            GlassFrameThickness="0,0,0,1"
                            ResizeBorderThickness="5" />
    </shell:WindowChrome.WindowChrome>

    <Grid x:Name="LayoutRoot">

    </Grid>
</Window>


(note, you need to have referenced Microsoft.Windows.Shell)
   
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900