Prevent RadPane Dragging Off the Screen

4 posts, 0 answers
  1. Ferenc
    Ferenc avatar
    2 posts
    Member since:
    Jun 2010

    Posted 19 Oct 2010 Link to this post

    Hello!

    I'm using RadDocking control. Unfortunately If i drag the floating window outside the view area of the browser and drop i cannot get it back.

    As i saw RadWindow control has a usefull "IsRestricted" property but there is no RadPane :(  Help me, please!

    Thank You
    Ferenc Kostka
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 19 Oct 2010 Link to this post

    Hello Ferenc,

    Thank you for contacting us.

    We have already added this request in our Public Issue Tracking System (PITS). You can view it here. You can vote for it, track its status and see when it is going to be implemented.

    Please feel free to contact us if you have any other questions.

    Kind regards,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Todd
    Todd avatar
    4 posts
    Member since:
    Jun 2010

    Posted 17 Nov 2010 Link to this post

    Here's a solution to this problem that forces the Pane back into view when it's been dragged off the screen:

    private ToolWindow getToolWindow(RadPane Pane)
     {
         ToolWindow toolWindow = Pane.ParentOfType<ToolWindow>();
         if (toolWindow == null)
         {
             toolWindow = (((Pane.Parent as RadPaneGroup).Parent as RadSplitContainer).Parent) as ToolWindow;
         }   
         return toolWindow;
     }
     private void radDockingMain_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
     {
         RadPane pane = e.Source as RadPane;
           
         if(pane != null && pane.IsFloating)
         {
             ToolWindow toolWindow = getToolWindow(pane);
               
             if (toolWindow != null)
             {
                 toolWindow.LostMouseCapture += new System.Windows.Input.MouseEventHandler(toolWindow_LostMouseCapture);
             }
         }  
     }
     void toolWindow_LostMouseCapture(object sender, System.Windows.Input.MouseEventArgs e)
     {
         ToolWindow toolWindow = (ToolWindow)sender;
         if (toolWindow.HorizontalOffset < 0)
         {
             toolWindow.HorizontalOffset = 1;
         }
         if (toolWindow.VerticalOffset < 0)
         {
             toolWindow.VerticalOffset = 1;
         }
         if (toolWindow.HorizontalOffset > radDockingMain.ActualWidth - 100)
         {
             toolWindow.HorizontalOffset = radDockingMain.ActualWidth - 100;
         }
         if (toolWindow.VerticalOffset > radDockingMain.ActualHeight - 100)
         {
             toolWindow.VerticalOffset = radDockingMain.ActualHeight - 100;
         }
     }

    Regards,
    Todd
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 23 Nov 2010 Link to this post

    Hi Todd,

    We are glad that you have found a solution yourself.

    I am sending you also our workaround. Please find the attached project.

    If you have any other questions about our controls please feel free to contact us again.

    Greetings,
    Konstantina
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top