Current filter:
                                You should refresh the page.
                                  • For our use case we need a window swapping feature instead of the tabbed groups in docking layout.
                                    I hooked some events to cancel the dock and reset the layout after the docking operation and swap the content of the LayoutPanels.

                                    This works as long as ShowContentWhenDragging is true. When I disable it, the layout reset or the event cancel does not seem to work properly.

                                    Please see the attached Sample.
                                    Try to Swap the content of two panels with the Center dock option when ShowContentWhenDragging is enabled and when it is disabled.

                                Show all comments
                                • Alexey Z (DevExpress Support) 08.13.2019

                                  Hello,

                                  Thank you for your sample. I see the difference in behaviors when the ShowContentWhenDragging property has different values. However, I need to be sure that we are talking about the same behavior. So, I have attached a video demonstrating how this works on my side. You can see that the dragged panel is undocked after swapping its content. Are you talking about this behavior? If not, please provide us with a video to demonstrate the issue. This information will allow us to find a suitable solution quickly.

                                • TomBea 08.13.2019

                                  Yes I was talking about the panel being undocked after swap.
                                  I don't know if this is the intended behavior, but can this be worked around?

                                • Andrey Marten (DevExpress Support) 08.14.2019

                                  Hello,

                                  Thank you for your clarification. My tests show that this issue is related to the fact that RestoreLayout is executed before all internal operations are completed. It should be sufficient to execute it with a small delay. Use the Dispatcher.BeginInvoke method to do this and check if this helps:

                                  [C#]
                                  private void DockContainerOnDockItemEndDocking (object sender, DockItemDockingEventArgs e) { if (e.DockType != DockType.Fill) return; e.Cancel = true; Dispatcher.BeginInvoke(new Action(() => { RestoreLayout(); var target = (LayoutPanel)e.DockTarget; var current = (LayoutPanel)e.Item; var content = target.Content; target.Content = current.Content; current.Content = content; })); }

                                  Thanks,
                                  Andrey

                                • TomBea 08.14.2019

                                  Hello Andrey,

                                  This does indeed provide the functionality we want to achieve, but the reason we choose to set "ShowContentWhenDragging=False" was, because we did not want the layout to "jump" while performing a swap.
                                  With Dispatcher.BeginInvoke the layout still jumps (see attachment)
                                  Can this be solved?

                                  Thanks for the help so far,
                                  Thomas

                                • Alexander Rus (DevExpress Support) 08.15.2019

                                  Hi Tom,
                                  Would you please describe your end goal in greater detail? Why do you need to save the layout in the DockItemStartDocking event handler and restore it in the DockItemEndDocking event handler? This information will help us provide you with the most suitable solution.

                                  Thanks,
                                  Alexander

                                • TomBea 08.15.2019

                                  Hello Alexander,

                                  Our goal is to create the functionality to swap the content of Panels without changing layout otherwise.
                                  We want to move away from our current, self implemented, solution and use DevExpress Docking but keep the general workflow. This includes dragging one Panel onto another and with this swapping the content.
                                  Because we do not want the tabbed layout, which by default is created when you drop it on the center item, we wanted to overwrite the center item with the swap functionality.
                                  RestoreLayout in EndDocking event was choosen because it seemed like a good way to reach that goal.
                                  We would be happy to change our approach, if you have an alternative solution to this problem.

                                  Thanks,
                                  Thomas

                                • Alexey Z (DevExpress Support) 08.15.2019

                                  Hello Thomas,
                                   
                                  Thank you for the detailed description. I have researched different ways to achieve this goal and the most suitable one is to restore the previously saved layout by wrapping it in the Dispatcher.BeginInvoke method as follows:
                                   

                                  [C#]
                                  Dispatcher.BeginInvoke(new Action(() => { RestoreLayout(); }));

                                   
                                  I have modified your application to demonstrate this approach. Please try it and let me know your results.

                                • TomBea 08.15.2019

                                  Sorry, I initially commented that it worked as expected, and it did in this case, but then I realized that my original sample missed the FloatingMode=Desktop. With Desktop FloatingMode the layout still jumps, while Window FloatingMode works as expected.

                                  Thanks,
                                  Thomas

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                Thank you for your additional description. I do not see how to prevent visual side effects when you use the Save/Restore layout operation in this scenario. That is why I recommend that you try other approaches to support this functionality.

                                I have found that you can disable the AllowFloat property in a target panel in the DockItemEndDocking event handler when the ShowContentWhenDragging property is disabled. With this approach, no visual side effects occur neither in the Desktop nor in the Window mode.

                                When ShowContentWhenDragging is enabled, this approach will not work. Instead, you can call the Dock method from your DockLayoutManager.DockController. In this case, you will still see panel movements as when you undock a panel it is immediately removed from the group.

                                I've modified the project to illustrate the main idea of the approach. Please note that this is not a final solution and you will need to adjust it according to your needs.

                                Thanks,
                                Andrey

                                • TomBea 08.18.2019

                                  Hello Andrey,

                                  Thank you all for your help so far. This seems to achieve my goal. I will test it further in the following days but for now I will mark your answer as solution.

                                  Thanks,
                                  Thomas

                                • Andrey Marten (DevExpress Support) 08.19.2019

                                  OK, Thomas. I look forward to your results.
                                  Andrey