Greetings.
I'm new at WPF and have little experience in WinForms (Most of my work has been in ASP.NET 2.0). I've created a simple WPF app which I want to dock to a screen edge. I've seen some "docking libraries" but they seem to be more into docking child windows to
each other in the Visual Studio style...
... Anyone know how I can dock a simple standalone form to an edge of a screen?
-
-
Response.Write(); // C9v4 bug bypass; disregard this reply
-
Being able to dock to the screen edge is not a native capability of either Windows Forms or WPF, so what you have to do in either case is make a call to the system API (which will be the shell32.dll library in this case). A window thats docked to the edge of the screen, like the taskbar or sidebar, is called in Windows documentation an AppBar or Application Desktop Toolbar.
There's not a tutorial on the web for WPF, so I'll first point you to two for Windows Forms:
http://www.codeproject.com/KB/dotnet/AppBar.aspx
http://www.codeproject.com/KB/shell/csdoesshell3.aspx
The most important difference in WPF is that instead of handling Windows Forms events for windows, like OnSizeChanged, you're going to need to use WPF equivalent events. You're also going to need to make use of the System.Windows.Interop library, which allows you to use the system API with your WPF application.
There may or may not be a library thats pre-written for you in managed code. I'm currently working on a project that uses AppBar and a Glass background, but I'd have to work on it more and clean up the code before I could give you the source. -
brian.shapiro said:Being able to dock to the screen edge is not a native capability of either Windows Forms or WPF, so what you have to do in either case is make a call to the system API (which will be the shell32.dll library in this case). A window thats docked to the edge of the screen, like the taskbar or sidebar, is called in Windows documentation an AppBar or Application Desktop Toolbar.
There's not a tutorial on the web for WPF, so I'll first point you to two for Windows Forms:
http://www.codeproject.com/KB/dotnet/AppBar.aspx
http://www.codeproject.com/KB/shell/csdoesshell3.aspx
The most important difference in WPF is that instead of handling Windows Forms events for windows, like OnSizeChanged, you're going to need to use WPF equivalent events. You're also going to need to make use of the System.Windows.Interop library, which allows you to use the system API with your WPF application.
There may or may not be a library thats pre-written for you in managed code. I'm currently working on a project that uses AppBar and a Glass background, but I'd have to work on it more and clean up the code before I could give you the source.I'd be interested in seeing the source code too, when you get it cleaned up. I've been able to specify the location on the screen that the app must start at, but it's nothing even remotley close to a docking function...
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.