This is a migrated thread and some comments may be shown as answers.

Docking not culling manually created SplitContainers & RadPaneGroups

11 Answers 224 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 06 Oct 2011, 10:20 PM
When a user wants a control added to their layout, we want it to pop up front and center.

So we do something on the order of: 

void MakeNewPane(RadPane newPane)
{
RadPaneGroup radPaneGroup = new RadPaneGroup();
RadSplitContainer splitContainer = new RadSplitContainer();
 
// Fixed 300x400 size, centered on the main window, so it's easy to find.
Window parentWindow = Window.GetWindow(this);
splitContainer.SetValue(RadDocking.FloatingSizeProperty, new Size(400, 300));
splitContainer.SetValue(RadDocking.FloatingLocationProperty, new Point((parentWindow.ActualWidth - 400) / 2, (parentWindow.ActualHeight - 300) / 2));
 
splitContainer.Items.Add(radPaneGroup);
radDocking.Items.Add(splitContainer);
 
radPaneGroup.AddItem(newPane, DockPosition.Center)
pane.MakeFloatingDockable();
}

That works well enough..  And from the user's point of view, they can drag/drop/stick the pane wherever they want..  all good so far.

When we go to save the layout though, it looks something like this:

<RadDocking>
        <SplitContainers>
          <RadSplitContainer Dock="DockedLeft" Width="414" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
            <Items>
              <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
                <Items>
                  <RadPane SerializationTag="PortfolioHierarchy1" IsDockable="True" Title="Hierarchy" Header="Hierarchy" CanDockInDocumentHost="False" />
                </Items>
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedTop" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
            <Items>
              <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
                <Items>
                  <RadPane SerializationTag="PortfolioSummary1" IsDockable="True" Title="Summary" Header="Summary" CanDockInDocumentHost="False" />
                </Items>
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
          <RadSplitContainer Dock="DockedLeft" Width="240">
            <Items>
              <RadPaneGroup SelectedIndex="-1">
                <Items />
              </RadPaneGroup>
            </Items>
          </RadSplitContainer>
        </SplitContainers>
      </RadDocking>


Note the extra RadSplitContainers and RadPaneGroups that are empty..

Looking through the code, there seems to be an internal property that I can't get to ( IsAutoGenerated="True")
that would allow the RadDocking to clean things up when refreshing..  basically delete the empty ones.

How can I do that through code?  I can't figure out if there's an event I should use to clean things up or if I can somehow use AutoGenerated groups/containers myself.  

I'd much rather just say:  radDocking.AddPane(newPane, CenterParent, 300x300), and let everything else be auto from there.  

-Peter

11 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 10 Oct 2011, 08:36 AM
Hi Peter,

 

The RadDocking control will dispose any autogenerated parts automatically if they are empty. Anyway, if these parts (RadSplitContainer, RadPaneGroups) are defined in the xaml, they stay alive and on SaveLayout are saved in the xml file. This is the current RadDocking behavior and everything that differs from this scenario could be considered as a bug.

Meanwhile, please refer to the following online documentation where you can find more detailed information about RadDocking save/load events - http://www.telerik.com/help/wpf/raddocking-features-save-load-layout.html

Hope this helps.


All the best,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 10 Oct 2011, 04:11 PM
Hi George,

So that didn't answer my question.

I'm creating the parts manually at runtime.  Basically, I want new "things" when added to be shown front and center floating over the docking group.  Then the expected behavior is for the user to put the new "thing" wherever they want.  This works from the user's perspective, but the underlying structure radDocking is keeping a whole lot of empty container/groups as shown in the config file I included.

Depending on your point of view, this is either a bug, or a missing feature:

Bug:  the empty container/groups should be removed (or I should have an option to mark them as "automatic" so they will be removed) when they no longer have any content.

Missing Feature:  There should be an event that I can bind to when the user reorganizes the layout, providing me with a from/to changed type event handler) giving me a place to delete the container/groups that are then left as empty. And this feature missing is bad enough to be a bug if I can't do this currently.

Better Missing Feature: radDocking.AddPane(newPane, CenterParent, 300x300), and let everything else be auto from there.  

-Peter
0
George
Telerik team
answered on 13 Oct 2011, 02:40 PM
Hello Peter,

I understand your frustrations, but created docking items (pane, groups, splitcontainers) in the button click handler are not autogenerated. Only the items, generated by the docking control when changing pane state are consider as autogenerated(by the control). Manually added items (created in xaml or in code) stay alive and this is by control design. 

I agree with you that in your scenario there is not reason to keep the empty items live. We will consider making the IsAutogenerated attached property with a public accessor. Using this property, you could control which items will be disposed(and not saved in the xml). Unfortunately, with the current version of the RadDocking control this is not possible, and for a workaround I would suggest manually cleaning the xml from empty containers.

Regards,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 13 Oct 2011, 03:52 PM
George,

Can you give me a case where you (or anyone) wouldn't want delete an empty group, once the user has re-arranged things on the screen?  

Anyways, we're talking about a boolean flag here.  It shouldn't be rocket science to expose it (heck, make it a parameter on the constructor "AutoDeleteIfEmpty" and I'll pass it in there..  IsAutogenerated is a poor name anyways given how it's being used.

Or better yet, give me a way that I can add my pane to your autogenerated tabs, preferably centered floating with x/y size.  

As it stands now, I'm very disappointed with the details behind the RadDocking.  Sure it looks nice at first, but in our first round of user testing, they found so many edge cases that it's not handling I'm afraid that I'm going to have to fix your code myself.  And that's NOT a good solution.  The use case you've built it for seems to be the setup behind Visual Studio.  And while you have the look and feel good, the implementation doesn't support what I would call a "dynamic" application.  one where the windows/panes/... aren't specifically known from day one.  

Please respond to the above..  But I'll also consolidate all of the deficiencies into a single thread later today.
0
Peter
Top achievements
Rank 1
answered on 13 Oct 2011, 04:52 PM
Also, On your link: http://www.telerik.com/help/wpf/raddocking-features-save-load-layout.html
There's no definition for "cleaned" re:
  • ElementCleaning - raised when a docking element (PanePaneGroup or SplitContainer) is about to be cleaned.
  • ElementCleaned - raised after a docking element (PanePaneGroup or SplitContainer) is cleaned.

I had to read through your code to figure out what that actually meant.  Bad documentation

At the very least, you should say:

As the first phase in the LoadLayout(), all currently loaded panes are "cleaned", or in other words, have their existing layout destroyed, so that that can be re-positioned during the remainder of the LoadLayout() process.
0
George
Telerik team
answered on 18 Oct 2011, 09:13 AM
Hello Peter,

Thank you for pinpointing us these problems with our online documentation. We will definitely improve it in our further releases.


All the best,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 20 Oct 2011, 11:54 PM
George,

You missed my other response from Oct 13.. ?
0
George
Telerik team
answered on 24 Oct 2011, 03:14 PM
Hi Peter,

 
Please, accept my apologies for this.

You could dynamically add panes into a PaneGroup using its x:Name. This is the most common scenario when you don't want to dispose manually generated groups, even if they are empty. If we dispose these groups, you could get null reference exception when you use the RadPaneGroup.Add(Radpane pane) method.

As I note, we consider making the IsAutogenerated attached property with a public accessor. Using this property, you could control which items will be disposed(and not saved in the xml) and this will resolve the issue. Unfortunately, the RadDocking control doesn't support adding a pane into an autogenerated group using code. We understand this is a missing feature and we will look into it for our further releases.


Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Manish
Top achievements
Rank 1
answered on 25 Jan 2017, 07:35 AM

How to add one splitcontainer in another splitcontainer ?

and Which property use in raddocking control.

i save this layout in xml and then open this layout from xml file.

0
Manish
Top achievements
Rank 1
answered on 25 Jan 2017, 07:40 AM

Hi Peter,

i have one problem i can't find one splitcontainer add in another splitcontainer to which property use in raddocking control.

and this type of layout save in xml and then open this layout from xml file.

0
Stefan Nenchev
Telerik team
answered on 27 Jan 2017, 02:26 PM
Hello Manish,

Please check the following article for more information on how to implemented nested RadDocking - Nested RadDocking Support.

Regards,
Stefan Nenchev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Docking
Asked by
Peter
Top achievements
Rank 1
Answers by
George
Telerik team
Peter
Top achievements
Rank 1
Manish
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or