Wednesday 25 February 2009

WPF Window tutorial Part I: shaped window

So, you want to create shaped window in WPF? Here is quick and simple recipe:


1. Create new project and add a Window to the project:

2. Get rid of windows style border and title bar, and make sure your window allows transparency:


3. Set the transparent Background, and you have your own *invisible* window:



Your code should be something like that:


4.Now - the fun part. You can pick the shape your window is going to be.
I've chosen to use border with rounded edges:

But you can also choose something else:

5. Run the application and here it is- shaped window!


Stay tuned for part 2 where I'll show you how to make your window resizable and movable, and how to make it close.

No comments:

Post a Comment