This is a migrated thread and some comments may be shown as answers.

Windows off screen & minimising fixed size windows

1 Answer 87 Views
Window
This is a migrated thread and some comments may be shown as answers.
max
Top achievements
Rank 1
max asked on 17 Nov 2008, 02:44 PM
Two problems I'm experiencing with RadWindow:

1. It's easy for the user to drag a RadWindow off the side of the Silverlight control, so that the window's title bar is no longer visible and hence it cannot be dragged back into view.  I've fixed this with the code at the bottom of this note, but it's a hack that will break if you guys change the RadWindow -- wouldn't it be better if it was done by the RadWindow itself?

2. There seems to be no way to have a window that can be minimised but not resized by dragging the window frame.  This is a very common scenario for things like tool palettes.  Could this be added?

3. While I'm at it, WindowStartupLocation.CenterScreen is wrongly named, and the help is wrong too.  It places the window in the centre of the Silverlight control or the browser window (I don't know which) but not the screen.

Cheers,

Max

RadWindow w;
w.LocationChanged += new RoutedEventHandler(w_LocationChanged);




    void w_LocationChanged(object sender, RoutedEventArgs e)
    {
        if (w.Left < 0)
            w.Left = 0;
        if (w.Top < 0)
            w.Top = 0;

        Panel p = (Panel)getPopupParent(w);
        if (w.Left + w.ActualWidth / 2 > p.ActualWidth)
            w.Left = p.ActualWidth - w.ActualWidth / 2;
        if (w.Top + w.ActualHeight / 2 > p.ActualHeight)
            w.Top = p.ActualHeight - w.ActualHeight / 2;
    }

    protected FrameworkElement getPopupParent(FrameworkElement e)
    {
        Popup p = e as Popup;
        if (p == null)
            return getPopupParent((FrameworkElement)e.Parent);
        else
            return (FrameworkElement)e.Parent;
    }

1 Answer, 1 is accepted

Sort by
0
Hristo Borisov
Telerik team
answered on 19 Nov 2008, 08:48 AM
Hi Max,

Yes, we are planning to include a boundary detection system of all our popup controls pretty soon. I hope that for the SP release we will introduce this new feature. In order to have a minimized RadWindow which cannot be resized you should edit the specific visual state in the controltemplate. For the next release we will evaluate the importance of having a separate logic for Resize and the header buttons. Actually, we have implemented the CenterScreen in the scope of the Silverlight Application. As you suggest, most probably we should think of extending the CenterScreen to the scope of the html element. Thank you very much for your valuable feedback, and we look forward to receiving any suggestions and comments about the controls in future.

Kind regards,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
max
Top achievements
Rank 1
Answers by
Hristo Borisov
Telerik team
Share this question
or