Change RadWindow size when pane opens

7 posts, 1 answers
  1. bluewater
    bluewater avatar
    24 posts
    Member since:
    Jan 2007

    Posted 19 Jan 2015 Link to this post

    I have my RadDocking inside a RadWindow. Whenever a pane opens, it obviously either overlays or compresses the space of the document host. However, I'd prefer the document host to remain fully visible while the pane is visible. The way I tried to achieve that is to increase the RadWindow size (by the size of the RadPane) whenever the RadPane opens. The overall effect would then be that of a pane that opens "to the outside" rather than "to the inside".

    I have replaced the ClickFlyoutBehaviour with my own version that first changes the window size and only then does StartOpenAnimation(). The problem I am getting is that the change of the RadWindow is done ok but then the pane is not shown at all. 

    Any ideas how the "open to the outside" effect can be achieved? Thanks!

    My Behavior:

     
      
    public class SPFlyoutBehavior : IFlyoutBehavior
        {
            void IFlyoutBehavior.OnMouseEnter(IFlyoutHost host, RadPane targetPane)
            {
            }
     
            void IFlyoutBehavior.OnMouseLeave(IFlyoutHost host)
            {
            }
     
            void IFlyoutBehavior.OnOpeningTimerTimeout(IFlyoutHost host)
            {
            }
     
            void IFlyoutBehavior.OnClosingTimerTimeout(IFlyoutHost host)
            {
            }
     
            void IFlyoutBehavior.OnPaneActivated(IFlyoutHost host, RadPane targetPane)
            {
                host.SetSelectedPane(targetPane);
     
                if (host.CurrentState == FlyoutState.Closed)
                {
                    host.StartOpenAnimation();
                }
            }
     
            void IFlyoutBehavior.OnPaneDeactivated(IFlyoutHost host, RadPane targetPane)
            {
                var selectedPane = host.SelectedPane;
                if (selectedPane != null && !selectedPane.IsActive && host.CurrentState == FlyoutState.Opened)
                {
                    host.StartCloseAnimation();
                }
            }
     
     
            private IFlyoutHost _host;
     
            void IFlyoutBehavior.OnPaneMouseLeftButtonDown(IFlyoutHost host, RadPane targetPane)
            {
                // get the RadWindow that we are sitting in
                var radWindow = targetPane.ParentOfType<RadWindow>();
                if (radWindow == null) return;
     
                _host = host;
         
                // wire up the size changed handler
                radWindow.SizeChanged += radWindow_SizeChanged;
     
                // change the size of the window
                radWindow.Width += targetPane.AutoHideWidth;
            }
     
            void radWindow_SizeChanged(object sender, SizeChangedEventArgs e)
            {
                if (_host == null) return;
     
                if (_host.CurrentState != FlyoutState.Opened)
                {
                   // now that the window size has been changed, show the RadPane (too bad we don't get a AnimationFinished() event
                    _host.StartOpenAnimation();
                }
                else
                {
                     //corresponding "re-shrink window" logic not yet implemented
                    _host.StartCloseAnimation();
                }
            }
        }
  2. Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 23 Jan 2015 Link to this post

    Hi Frank,

    We investigated the provided code snippet. However, we are not sure that we completely understand the desired by you behavior of RadPane. Could you please provide us some more detailed information about your scenario - where exactly do you expect the Pane to open? Sending us an image or a video of the desired behavior would be of great in our further investigation in order to provide you with an information if the desired is achievable.

    We're looking forward to hearing from you.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. bluewater
    bluewater avatar
    24 posts
    Member since:
    Jan 2007

    Posted 23 Jan 2015 in reply to Nasko Link to this post

    Nasko,

    thank you for looking into this. I am attaching some wire frames that show what I need:

    "A" is a RadWindow with a RadDocking control, the RadPane docked right, currently closed. The window content does not really tolerate being compressed, so the  RadPane, when opens, correctly slides over the Content -> "B"

    "B": Now the user can see the content of the pane but not his original window, as it is overlaid by the pane. This is not good, he needs to see both at the same time.

    "C": Of course I can make the window so big that both, the original content and the opened pane, fit in, side by side. But then, once the user closes the pane, there is a whole lot of unused space ("D").

    What I want is a docking behavior that starts with state "A" and, once the user clicks the pane (auto-hide area, ClickFlyoutBehavior), expands the window to look like "C", and vice versa. 

    I would have thought that this is easy to accomplish, but every time my Behavior changes the window size, the entire pane becomes invisible.

    Thank you for your support.
    bluewater
  5. Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 26 Jan 2015 Link to this post

    Hello Frank,

    Thank your for the provided image it really helped us to better understand your scenario.

    We take a look at the provided code snippet again and assume that the disappearing of the Pane could be caused due to the inaccurate Width set to RadWindow when it is clicked for a second time in order to be hide. For example if the initial Width is 300 and it became 450 it is recommended to be set again to 300 when the Pane hides -  a width smaller than the initial one is probably causing that behavior.

    We hope that this information will help you.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. bluewater
    bluewater avatar
    24 posts
    Member since:
    Jan 2007

    Posted 27 Jan 2015 in reply to Nasko Link to this post

    Hi Nasko,

    thanks for your reply, but your analysis does not seem to match the problem that I am observing: I click the auto-hide button the first time, the ClickFlyoutBehavior kicks in, changes the window width, and *already then* the pane does not show. If I do not resize the window, then the pane does show. So my problem happens on the first ("open") click, not on the subsequent closing of the pane and I am not sure how to implement your recommendation.

    Thx,
    Frank
  7. Answer
    Nasko
    Admin
    Nasko avatar
    588 posts

    Posted 30 Jan 2015 Link to this post

    Hello Frank,

    We will need a sample project that reproduces the described scenario in order to continue our investigation and provide you with a prompt solution if the desired is achievable. Could you please try to provide us one?

    We are looking forward to hearing from you.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. bluewater
    bluewater avatar
    24 posts
    Member since:
    Jan 2007

    Posted 14 Feb 2015 in reply to Nasko Link to this post

    Hi Nasko,

    I have in the meantime decided not to continue developing using Silverlight but will base all new development on HTM5/JS/Kendo UI. So my question can be closed.
    Thank you again,

    Frank
Back to Top
DevCraft banner