PaneGroup.[Un]PinAllPanes()

8 posts, 0 answers
  1. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 23 Apr 2014 Link to this post

    Hi Telerik,

    What exactly do these methods do?  When I call either of them nothing seems to happen.

    I have a PaneGroup with two panes.  If the user clicks Pin on the first one, and then clicks Pin on the second one, they become tabbed.

    What properties or methods do I need to set in order to create the same effect?  I'm subscribing to the Dock.Pin/Unpin events and the set all of the panes in the pane group accordingly.  If they pin one, I want them all to be pinned, not collapsed, and tabbed.  If they unpin one, I want them all unpinned and collapsed.

    Thanks!!
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 24 Apr 2014 Link to this post

    Hi WILLIAM,

    The UnpinAllPanes and PinAllPanes methods of any RadPaneGroup correspondingly unpin or pin all of that group's RadPane instances. Note that only RadPane instances that are docked outside of the DocumentHost of the control and are not floating can be pinned or unpinned. When Panes are in the DocumentHost or are made floating the pin and unpin features are no longer possible.

    I created and attached a sample project for you in which the mentioned methods work as expected. Please let us know if we have missed something.

    Regards,
    Vladi
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 24 Apr 2014 in reply to Vladi Link to this post

    Thanks for the example.  I see this is working and this is the behavior I would like.  The only difference would be that you've created separate buttons that you have to click.  Instead of the buttons, subscribe to the [Un]Pin events of RadDocking.  When you click the pin on one pane, then all panes in the group should be Pinned/Unpinned.  When I call PaneGroup.PinAllPanes(), none of the panes are tabbed, and only the one that was clicked is activated.
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 24 Apr 2014 Link to this post

    Hello William,

    I apologize for missing that detail. When using the described methods in order to pin or unpin all RadPane instances of a RadPaneGroup inside the Unpin/Pin events you will need to wrap the call with a Dispatcher. When a RadPane is being unpinned/pinned there is an animation that is triggered. Since the call of the PinAllPanes/UnpinAllPanes methods is immediately inside the Pin/Unpin events which are executed before the animation has completed there is a timing issue that is resolved by warping the call with a Dispatcher.

    The next code snippet shows how to achieve the described behavior in those events:
    private void RadDocking_Pin(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
    {
        Dispatcher.BeginInvoke(new Action(() =>
        {
            this.Panegroup.PinAllPanes();
        }));
    }
     
    private void RadDocking_Unpin(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
    {
        Dispatcher.BeginInvoke(new Action(() =>
        {
            this.Panegroup.UnpinAllPanes();
        }));
    }

    Hope this is helpful.

    Regards,
    Vladi
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 24 Apr 2014 in reply to Vladi Link to this post

    Thanks again for your help!!

    Getting Closer; this is almost perfect.  Using the dispatcher to Pin/Unpin the panes achieves the behavior I'm looking for.  However, there are two issues I'm seeing.  

    1.  After unpinning, one of the flyouts will repeatedly and very quickly start opening and closing and there is nothing you can do to stop it.  I have only seen this happen twice.
    2.  After unpinning, all of the panes in the group fail to activate/flyout when the mouse is over them.  The tab will "highlight" like it's about to flyout, but it never does.  The number of times you have to pin/unpin before it stops responding varies, but eventually they stop responding.

  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 25 Apr 2014 Link to this post

    Hi William,

    After researching the described issues it looks like using the UnpinAllPanes/PinAllPanes methods in the corresponding events of the control is not bulletproof and may lead to unexpected behavior. We logged the issue in our feedback portal where you can track its status. Because the UnpinAllPanes method unpins all of the RadPane instances it is causing the Unpin event of the control to be triggered for each pane and when there is a call for the UnpinAllPanes in that event it is called multiple times on the same instances which corrupts the expected unpin action in the control. The above is valid for the PinAllPanes method also.

    I updated your Telerik points for bringing this to our attention. We will do our best to have a fix for it as soon as possible.

    Regards,
    Vladi
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 12 May 2014 in reply to Vladi Link to this post

    I implemented the following code which seems to have solved both of these issues.  Keeping count of the panes as they pass through the method and setting the pane that initiated the sequence to IsActive seemed to fix the rapidly opening and closing.  The next issue of the pane not activating again after unpinning all of the panes was still occurring.   After further investigation, I found that if Unpin is initiated from the same pane as the Pin, then all of the panes seem to work as expected regarding activating again during the MouseOver.  While this seems to work, I'm not sure if there are other unintended consequences by this implementation.

    My questions are:
    1.  Is the MouseOver event that activates the flyout adversely affected by the internal telerik code that you mention above as not being bulletproof?
    2.  Do you even suggest being able to pin/unpin all panes on the fly at runtime?
    3.  If other unintended consequences are found, should I continue to try to make this work, or remove the functionality until the issue is properly addressed by the Dock/Pane control(s)?

    Thanks for your help!!!

    var paneGroup = args.ChangedPane.PaneGroup;
    _paneCount = paneGroup.EnumeratePanes().Count();
     
    //After pinning/unpinning all of the panes once, none of the panes would respond to
    //the mouse over event and flyout.  I discovered, that if the unpin happens from the
    //the same pane as the pin event, the mouse over event continues to work.
    //1.  When the PIN event is called, set CanUserPin = false.  This will hide the Pin button on all other panes
    //1a. After all panes have passed through this function, the original pane will have it's CanUserPin set to True (See Below)
    //2.  When the UNPIN event is called, set CanUserPin = true.  This will show the Pin button on all panes as they activate
     
    if (eventName == "PIN")
    {
         paneGroup.Dispatcher.BeginInvoke(paneGroup.PinAllPanes);
         args.ChangedPane.CanUserPin = false;
    }
    else
    {
         paneGroup.Dispatcher.BeginInvoke(paneGroup.UnpinAllPanes);
         args.ChangedPane.CanUserPin = true;
    }
     
    //this method will be call multiple times due to calling Un/PinAllPanes.
    //1.  Determine How many panes are in the group
    //2.  Keep count of how many panes have passed through this method
    //3.  When the last pane is being processed:
    //3a. Make selectedPane Active (which was the first pane to pass through this event)
    //3b. Set CanUserPin = true.  This forces the user to Unpin the panes from the selected pane only
     
    if (!_counting)
    {
         _paneToSelect = args.ChangedPane;
         _paneCounter = 1;
         _counting = true;
    }
    else if (_paneCount == _paneCounter)
    {
         _paneCounter = 0;
         _counting = false;
         if (eventName == "PIN")
         {
              _paneToSelect.IsActive = true;
              _paneToSelect.CanUserPin = true;
         }
    }
     
    _paneCounter++;
    args.Handled = true;

  9. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 14 May 2014 Link to this post

    Hi William,

    Thank you for sharing with us the implementation of the possible solution to the previously described issues. As the issue is a strange one that is caused by a rapid events triggering we cannot confirm that the described CanUserPin toggling is an bulletproof approach that will not lead to any other unexpected behaviors in the control. Initially the UnpinAllPanes/PinAllPanes methods were implemented to provide an way to unpin/pin all RadPanes of a RadPaneGroup when implementing such feature that is triggered outside of the control. Inside the control the unpin/pin functionality is handled by each RadPane's unpin/pin button. Since the Unpin/Pin events of the control are called for each RadPane instance using a method inside those events that explicitly triggers them is not something that we anticipated when initially implementing those methods.

    As we see that this is an approach that many of our users would like to use we will do our best to fix the related with it issues. One approach with which the mentioned behavior could be implemented without the use of the events is to customize the PaneHeaderStyle and in its Template replace the built-in unpin/pin buttons with buttons that call a custom ICommand which uses the methods.

    I created and attached a sample project for you of the described approach. We apologize for any inconvenience that this may be causing.

    Regards,
    Vladi
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
DevCraft banner