Functionality Suggestion: Window Snap

2 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    573 posts
    Member since:
    Mar 2004

    Posted 13 Mar 2013 Link to this post

    I am developing an MDI-like interface similar to your demo...

    It would be great if Telerik could create some "snap" functionality into Rad Window, similar to the window snap functionality availalble in Windows 7+. I would like to be able to drag a rad window to the side of it's container and then have some way of "snapping" it so that it occupies 100% height and 50% width, left or right. It would also be cool if you could drag the window to the top or bottom of its container and then snap it their as well  50% height, top or bottom and 100% width). I'm not sure why the Windows folks didn't include vertical snap, but maybe there's some technical issue.

    Anyhow, allowing users to quickly size windowsby snapping them for side by side (or top/bottom) display would really be useful for many MDI type implementations.

    I imagine the Rad Window already has client-side capabilities for detecting when one of the window edges has reached its container boundary. They key would be providing users with some sort of visual cue that they can "snap" the window to that particular boundary (left/right and, ideally, top/botom).

    Of course, it would probably be necessary to provide some sort of toggle property so users could turn this functionality on/off, or perhaps an enumeration property... like  SnapBehaviors="EnableSnapVertical, EnableSnapHorizontal, EnableSnapLeft... etc.)
  2. Marin Bratanov
    Marin Bratanov avatar
    3907 posts

    Posted 14 Mar 2013 Link to this post

    Hello Albert,

    The RadWindow does not offer this functionality out of the box and handling the mouse like this is by far not a trivial task and in this case we have browser resizing to take care of, which is something the desktop system does not have.  Another major issue is that once dragging has started you cannot stop the mouse pointer from leaving the viewport like a desktop system confines the pointer in the monitor (assuming it is only one, of course).

    What could be easier is to add buttons that will set appropriate size for the RadWindow and optionally pin it. The following resources can be helpful in this regard
    RadWindow API
    Setting size in percent for the RadWindow
    Adding a Custom Button to RadWindow Titlebar

    Should you succeed in creating this functionality you could post it in the Code Library and we will be glad to reward your efforts with Telerik points, even if it uses buttons and not the mouse drag.

    You can also find attached a simpel page that shows how coordinates of a RadWindow can be obtained in realtime so you can build the rest of the logic (adding a visual indicator - e.g. a fixed div with some transparency) and start resetting the RadWIndow position if it starts going out of the browser viewport.

    You can also post your suggestion in our Feedback portal so other people can vote and comment on it as well.

    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top