Excerpt from an internal email at EPS/CODE:

CODE Framework now has a feature that makes it easy to make borderless windows that can still be resized and moved around on the screen. For instance, let’s say you make a window like the Word 2013 start screen:


This window has no standard border, but you can actually click anywhere in the window and drag it around with your mouse (although you cannot change the size).

Another example is the main Word app, which also doesn’t use a standard window border or title. But you can still move the window around by grabbing it in the title area, and you can resize it like you would expect:


You can now create the same sort of window in our WPF framework very easily. To do so, create a XAML window declaration like this:

<Window x:Class="CODE.Framework.Wpf.TestBench.CustomBehaviorWindow" 
        Height="300" Width="300"
        MinHeight="50" MinWidth="100"
        WindowStyle="None" ResizeMode="NoResize" 

Note that the WindowStyle is set to None, and ResizeMode (somewhat confusingly) is set to NoResize. This is standard WPF stuff to create a window without a border, which gives you the right look but not the right behavior.

Now we add the new behavior. See the attached properties? Those can be used to turn on various custom behaviors:

  • AutomaticWindowDragEnabled enables – wait for it – the drag behavior. So with this set to True, you can drag the window around. Whether this works in the whole window area or just in what you consider the part of the window that is the header is dependent on whether you declare what your supposed header is. If the HeaderHeight property is set to anything but 0, the drag operation only works in the header area (in the example above, everything within 26 pixels of the top edge of the window is considered the header area). If you leave this value at 0 (or don’t touch it at all), the entire window is drag-enabled and thus movable by clicking anywhere in the window.
  • AutoWindowMaximizeEnabled allows to double-click in the header (or whole window depending on whether you declare a header area… this behaves just like the prior property) to maximize the window (or return it to normal state if it is already maximized).
  • AutoWindowResizingEnabled defines on whether the window supports standard resize behavior by dragging on the sides or the corners of the window.


Last edited Dec 21, 2012 at 10:23 PM by MarkusEgger, version 3


No comments yet.