Drag Drop defaults to hardcoded size

2 posts, 0 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Jul 2011

    Posted 24 Jan 2012 Link to this post

    I have a RadDocking control layed out with two rows(showing the serialized layouot) that are set with relative size(percentage based)
    .
    <RadSplitContainer Dock="DockedLeft" Orientation="Vertical">
        <Items>
          <RadSplitContainer RelativeWidth="400" RelativeHeight="200">
            ....        
        </Items>
          </RadSplitContainer>
          <RadSplitContainer RelativeWidth="400" RelativeHeight="200" Orientation="Horizontal">
            <Items>
              ....            
            
    </Items>
              </RadSplitContainer>
            </Items>
          </RadSplitContainer>    
        </Items>
      </RadSplitContainer>

    When a user drags a RadPaneGroup to the root(top) it will always create a RadSplitContainer with a hardcoded height. example below.
    Note* notice the Height="180"
    <?xml version="1.0" encoding="utf-8"?>
    <RadDocking>
      <SplitContainers>
        <RadSplitContainer Dock="DockedTop" Height="180" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
          <Items>
            <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="TileId=4" IsHidden="False" IsDockable="True" Title="" Header="" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
        <RadSplitContainer Dock="DockedLeft" Orientation="Vertical">
          <Items>
                  .....    
        </Items>
        </RadSplitContainer>
      </SplitContainers>
    </RadDocking>

    I need to keep everything relative. How do we change the behavior so RadDocking  does not use hardcoded sizes?
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 27 Jan 2012 Link to this post

    Hi,

    You could use the IGeneratedItemsFactory to create custom SplitContainers with specific properties set. You could find an example of its use here. It illustrates its implementation for creating custom ToolWindows. First, you need to create new class which inherits DefaultGeneratedItemsFactory and override the CreateSplitContainer method, for example:

    public class GenerateSplitContainer : DefaultGeneratedItemsFactory
            {
                public override RadSplitContainer CreateSplitContainer()
                {
                    return new RadSplitContainer { Width = 200, Height = 200 };
                }
            }

    And then set the new items factory to the Docking control:

    <telerik:RadDocking>                     
                    <telerik:RadDocking.GeneratedItemsFactory
                        <local:GenerateSplitContainer /> 
                    </telerik:RadDocking.GeneratedItemsFactory
    ....... 
    </telerik:RadDocking>

    Hope this helps. Please do not hesitate to contact us again if you have further questions.

    Kind regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
Back to Top