Tuesday, January 25, 2011

WPF: Creating a borderless window

For a new application we are building we want to have a completely different look for the windows in our application. Therefore we wish to eliminate the border to give it a custom look. Doing this in WPF is easy. To get a border-less window, you need to set the following attributes on your Window.

  • WindowStyle="None"
  • AllowsTransparency="True"
  • Background="Transparent"

The WindowStyle attribute normally allows you to set a single border, three-D border, or a Tool Window border. Setting this attribute to None will eliminate the border. The next two attributes, AllowsTransparency and Background work together. You must set AllowsTransparency to True to allow the Background to be set to Transparent.

No comments: