Handling RadPane docked/floating event

16 posts, 0 answers
  1. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 21 Oct 2013 Link to this post

    Hi everyone,

    I am developing a WPF application in which I use RadControls including RadDocking.
    I want to execute code when a RadPane becomes docked or floating.
    Is an event raised when a RadPane becomes docked or floating ?

    Thank you in advance for your help
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 21 Oct 2013 Link to this post

    Hello Pascal,

    You can use either the Pin/Unpin events of the Docking control or the PaneStateChange event inside which handler you can check the state of the Pane. For more detailed information about the events of the Docking you can check the following article from our online help documentation:
    http://www.telerik.com/help/wpf/raddocking-events-overview.html

    Hope this helps.

    Regards,
    Kalin
    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
  4. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 21 Oct 2013 Link to this post

    Thank you for your answer.
    I have implemented an handler for the PaneStateChange event.
    Here is an extract from my handler :

    private void DockingPaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        RadPane l_pane = e.OriginalSource as RadPane;
        RadPaneGroup l_group = l_pane.PaneGroup;
        // ...
    }

    I have launched my application.
    A RadPane has been docked into a RadPaneGroup in the beginning of the execution.
    The RadPaneGroup's Name property was set to "m_group1".
    The RadPaneGroup was referenced by an instance property named Groupe1.

    Then I have made the RadPane floating by draging it out.
    The execution has stopped at a breakpoint in my handler.
    I have noticed that l_group.Name has returned an empty string.
    In addition I have noticed that l_group did not refer to the RadPaneGroup referred by Groupe1 property.

    How can I get a reference to the RadPaneGroup from which the RadPane has been undocked ?
    I can not use the Groupe1 property because a RadPane can be added to other groups.

    Thank you for your future answer
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 24 Oct 2013 Link to this post

    Hi Pascal,

    The Pane is moved out of its original PaneGroup when dragged out, so you will have no reference to the original group. However as a suggestion on how to restrict the Pane from docking to another PaneGroup you could implement a Conditional Docking. Please note that the Panes and PaneGroups should have names, this way you could check whether to restrict the docking or not. For your convenience I have prepared and attached here a sample project which demonstrates the exact approach.

    Hope this work for you. If you have any further questions let us know.

    Regards,
    Kalin
    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 >>
  6. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 24 Oct 2013 Link to this post

    Thank you for your answer.
    I have got another issue relative to the PaneStateChange event.

    Here is my initial Docking's layout :
    <?xml version="1.0" encoding="utf-8"?>
        <RadDocking>
          <DocumentHost>
            <RadSplitContainer SerializationTag="m_splitContainer2" Orientation="Vertical">
              <Items>
                <RadPaneGroup SerializationTag="m_paneGroup2" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
                <RadPaneGroup SerializationTag="m_paneGroup3" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
              </Items>
            </RadSplitContainer>
          </DocumentHost>
          <SplitContainers>
            <RadSplitContainer SerializationTag="m_splitContainer1" Dock="DockedLeft" Width="240">
              <Items>
                <RadPaneGroup SerializationTag="m_paneGroup1" SelectedIndex="-1">
                  <Items />
                </RadPaneGroup>
              </Items>
            </RadSplitContainer>
          </SplitContainers>
        </RadDocking>

    A RadPane is made floating programmatically in the runtime beginning.
    The RadPane is contained in a RadPaneGroup named m_paneGroup4 which is itself contained in a RadSplitContainer named m_splitContainer3.

    I have docked the RadPane into m_paneGroup2 by draging the RadPane.
    A breakpoint was hitted in my PaneStateChange event handler.
    The RadPane's IsFloating property was set to false and that is what I expected.
    The RadPane's PaneGroup property was referring to m_paneGroup4 but I expected m_paneGroup2.
    Then I have pressed F5 to continue program run.

    The breakpoint was hitted again before I was able to do anything.
    The RadPane's PaneGroup property was set to null.

    Why the RadPane's PaneGroup property was not referring to m_paneGroup2 in my event handler ?

    Thank you in advance for your help.
  7. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 28 Oct 2013 Link to this post

    Hi Pascal,

    When the Pane is docked to a particular PaneGroup, its PaneGroup property holds a reference to that PaneGroup. I created a sample project which tests the scenario and works as expected, please check the attachment.

    Hope this helps. If you have any other questions let us know.

    Regards,
    Kalin
    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 >>
  8. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 28 Oct 2013 Link to this post

    Thank you for your rich answer.

    I have performed a test in your sample project.
    1.png shows the UI before the test.

    Here are the steps I have followed :
    1. I have clicked Float Pane 1 button. 2.png shows the UI after this step.
    2. I have dragged Pane1 into PaneGroup2. 3.png shows the UI during this step. 4.png shows the UI after this step. PaneGroup2's name is not displayed in TextBlock. Is it normal ?

    Thank you in advance for your help.
  9. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 28 Oct 2013 Link to this post

    Hello Pascal,

    The project works correctly on our side using the latest version of the controls. Could you please let us know which version you are using, so we can investigate the explained issue further?

    I'm looking forward to your response.

    Regards,
    Kalin
    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 >>
  10. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 28 Oct 2013 Link to this post

    Hi,

    Here are the versions of the Telerik assemblies I have referenced in your project :
    Telerik.Windows.Controls
    Version : 2012.2.912.40
    File Version : 2012.2.0912.40

    Telerik.Windows.Controls.Docking
    Version : 2012.2.912.40
    File Version : 2012.2.0912.40

    Telerik.Windows.Controls.Navigation
    Version : 2012.2.912.40
    File Version : 2012.2.0912.40

    Telerik.Windows.Data
    Version : 2012.2.912.40
    File Version : 2012.2.0912.40

    I hope this helps.
  11. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 29 Oct 2013 Link to this post

    Hi Pascal,

    We tested the project with the mentioned version and the explained behavior was present. However as this is fixed in the later version of the Control I would recommend that you upgrade to the latest Q3 2013 version in order to avoid that issue.

    Hope this helps.

    Regards,
    Kalin
    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 >>
  12. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 29 Oct 2013 Link to this post

    Thank you for your answer.

    Can you please confirm me the following behavior under the latest Q3 2013 version :
    Does the PaneGroup property correctly hold a reference to the destination PaneGroup when the RadPane is docked into a PaneGroup in the DocumentHost SplitContainer ?
  13. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 30 Oct 2013 Link to this post

    I am replying to this thread to signal I have edited my previous post.
  14. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 30 Oct 2013 Link to this post

    Hello Pascal,

    I confirm that this issue is not present with the latest version of the controls (Q3 2013). I've also recorded a video with the test project which demonstrates the correct behavior.

    If you have any other questions let us know.

    Regards,
    Kalin
    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 >>
  15. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 10 Nov 2013 Link to this post

    Hi,

    I have created a sample application using the trial version 2013.3.1016.40 of RadControls for WPF.
    Here is the markup of the main window :

    <Window x:Class="PaneStateChange.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <telerik:RadDocking PaneStateChange="DockingPaneStateChange">
                <telerik:RadSplitContainer InitialPosition="DockedLeft" Width="240">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane x:Name="m_pane">
                            <TextBlock>TextBlock</TextBlock>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
     
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer>
                        <telerik:RadPaneGroup x:Name="m_paneGroup1">
     
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
            </telerik:RadDocking>
        </Grid>
    </Window>

    Here is the code-behind of the main window :

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
     
            m_pane.MakeFloatingDockable();
        }
     
        private void DockingPaneStateChange(object p_sender, Telerik.Windows.RadRoutedEventArgs p_args)
        {
            RadPane l_pane = (RadPane)p_args.OriginalSource;
            RadPaneGroup l_paneGroup = (RadPaneGroup)l_pane.PaneGroup;
        }
    }

    I have set a breakpoint on the closing bracket of the DockingPaneStateChange handler and then I have launched the application.
    I have manually docked m_pane into m_paneGroup1.
    The breakpoint in DockingPaneStateChange has been hitted but l_paneGroup was null.
    It seems this issue has not been solved in the Q3 2013 version.
  16. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 11 Nov 2013 Link to this post

    Hello Pascal,

    Thanks for the provided sample code. When the Pane is docked into the DocumentHost the PaneStateChanged event is called more than once (in this case twice) as it is triggered from internal changes of the Pane. And on the second call the PaneGroup property of the Pane is already updated and it is pointing to the correct group. So if you need the PaneGroup on the first time the event is raised you will have to use a Dispatcher, I have attached a sample project which demonstrates the exact approach.

    Hope this helps.

    Regards,
    Kalin
    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 >>
  17. Pascal GUERY
    Pascal GUERY avatar
    38 posts
    Member since:
    Apr 2010

    Posted 12 Nov 2013 Link to this post

    Thank you for your answer.
    I have tested your solution and it works as expected.
Back to Top
UI for WPF is Visual Studio 2017 Ready