setFloatingLocation() method

2 posts, 0 answers
  1. Achim
    Achim avatar
    9 posts
    Member since:
    Aug 2013

    Posted 26 Aug 2013 Link to this post

    Hey there,

    I have a question about the setFloatingLocation() - method. I want to use it to place a floating pane in the middle of the main window of my app, also after the user has resized the main window. The method works fine for the first time I open the floating pane, but when i close the floating pane, resize the main window and then open the floating pane again, it re-opens at the same position it was before. Whay does the setFloatingLocation(pane, setPosition()); not work?

    public void OnNewCbs(RadDocking dockingManager)
            {
                RadPane pane = GetPane(dockingManager.Panes, "NewEditCbs");
                if (pane != null)
                {
                    RadDocking.SetFloatingLocation(pane, setPosition());
                    pane.IsHidden = false;
                }
                else
                {
                    pane = new RadPane();
                    pane.Header = "New CBS/ Edit current CBS";
                    pane.Name = "NewEditCbs";
                    Frame frame = new Frame();
                    frame.Content = new CbsNewAndEditView();
                    pane.Content = frame;
                    pane.CanDockInDocumentHost = false;
                    ((RadPaneGroup)((RadSplitContainer)dockingManager.DocumentHost).Items[0]).AddItem(pane, DockPosition.Center);
                    RadDocking.SetFloatingSize(pane, new Size(470, 740));               
                    RadDocking.SetFloatingLocation(pane, setPosition());
                    pane.MakeFloatingOnly();
                }
            }
     
            private Point setPosition()
            {
                Double x = ((App)App.Current).MainWindow.Left + (((App)App.Current).MainWindow.ActualWidth / 2.0 - 470.0 / 2.0);
                Double y = ((App)App.Current).MainWindow.Top + (((App)App.Current).MainWindow.ActualHeight / 2.0 - 740.0 / 2.0);
                Point p = new Point(x,y);
                return p;
            }

    Thank you for your help!

    Regards,
    Achim
  2. George
    Admin
    George avatar
    1332 posts

    Posted 28 Aug 2013 Link to this post

    Hi Achim,

    The FloatingLocation defines the exact position where the floating pane will be shown (it's not relative to the docking control. Could you share with us what do you expect in this scenario? What is the expected and the real behavior?

    I am glad to assist you further.

    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top