Sizing a radPane

50 posts, 1 answers
  1. Jonathan
    Jonathan avatar
    13 posts
    Member since:
    May 2009

    Posted 27 May 2009 Link to this post

    I am trying to use radDocking in a Silverlight 2 application to provide panels of additional information (docked) and a context menu (floating).

    I'm a little new to Silverlight and have been struggling to resize the radPane elements. Specifically I want to control the initial size of the floating radPane.

    I've tried using the RadDocking.FloatingSize property.
    For example
    <telerikDocking:RadPane Header="Actions..."  telerikDocking:RadDocking.FloatingSize="100 125">

    However, when the above radPane is displayed, it is always the same default size. I'm sure I'm missing something simple, but is there a way of controlling the size please?

    Thanks in advance...

    Jonathan

  2. Answer
    Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 May 2009 Link to this post

    Hello Jonathan,

    As it is shown in our examples (http://demos.telerik.com/silverlight/#Docking/FirstLook) you can show initially floating pane only if you put it in a RadPaneGroup, put the group into a SplitContainer and mark the whole SplitContainer as floating. The same way you set the initial size of the window and its initial position - by setting the Attached properties RadDocking.FloatingLocation and RadDocking.FloatingSize on the marked as floating SplitContainer

    Please take a look at the following example code (it is part of the code from the First look example of the Docking control):
    <radDock:RadSplitContainer InitialPosition="FloatingDockable" 
            radDock:RadDocking.FloatingLocation="250, 50" 
            radDock:RadDocking.FloatingSize="300, 220"
        <radDock:RadPaneGroup> 
            <radDock:RadPane Header="floating pane"
                <radDock:RadPane.Content> 
                    <TextBlock TextWrapping="Wrap" 
                            Text="some text" /> 
                </radDock:RadPane.Content> 
            </radDock:RadPane> 
        </radDock:RadPaneGroup> 
    </radDock:RadSplitContainer> 

    Hope this helps you achieve your goal.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. DevCraft banner
  4. Jonathan
    Jonathan avatar
    13 posts
    Member since:
    May 2009

    Posted 28 May 2009 Link to this post

    Hello Miroslav,

    Many thanks for the fast reply.
    I've moved the FloatingSize to the SplitContainer as you have shown and the pane is now sizing correctly when first loaded.
    There is still an issue though, that if the user docks the pane and then undocks it, the pane reverts to the default size again rather than using the FloatingSize set in the xaml. Is this expected behaviour?

    Thanks again
    Jonathan

  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 May 2009 Link to this post

    Hi Jonathan,

    Yes, this is expected as the SplitContainer that holds that information is destroyed with the ToolWindow.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. Riccardo
    Riccardo avatar
    36 posts
    Member since:
    Apr 2009

    Posted 05 Jun 2009 Link to this post

    Hello boyz, I've a toolbar and I dock it on right side of RadDocking. I set (on RadSplitContainer) an initial width of 50px. In the RadPane I've a RadWrapPanel with many images (25x25px).

    When I drag and drop it on TOP, the height becomes really too much height (100-200px). How can I set that dimension: final result maybe a vertical toolbar (on right dock) or horizontal toolbar (on top dock).

    I hope I explian correctly :)
  7. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 08 Jun 2009 Link to this post

    Hello Riccardo,

    Could you please provide a sample application that exposes the problem? Also a screen-shot on the desired result would also be of great help.

    We apologize for this additional loop required, but we need this information so that we can provide more-to-the-point reply.

    Greetings,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  8. Riccardo
    Riccardo avatar
    36 posts
    Member since:
    Apr 2009

    Posted 09 Jun 2009 Link to this post

    Dear Kaloyan,
    my trouble is really simply.
    When you create a RadPane in XAML you may set width / height.
    If you create a RadPane "A", docked on RIGHT, you can set Width = 100px and Height = AUTO.

    If you drag that RadPane and dock it on TOP, it become Width = AUTO e Height "undefined"... over programmer control. Now I'm try to resolve this trouble via c#... with SizeChanged I track RadPane movement, check its position (dock top,right,left,bottom) and resize it.

    Thanks.
    Riccardo
  9. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 09 Jun 2009 Link to this post

    Hello Riccardo,

    As a workaroung I will suggest that you use the Load event of the RadPane control as RadDocking doesn't expose event that can be used to determine when and where a Pane is dropped. Check the code snippet below as a solution to your case:

     
    public Page() 
            { 
                InitializeComponent(); 
     
                pane.Loaded += new RoutedEventHandler(pane_Loaded); 
            } 
     
            private void pane_Loaded(object sender, RoutedEventArgs e) 
            { 
                var pane = sender as RadPane; 
     
                if (pane.IsFloating) return
                 
                var parent = pane.ParentOfType<RadSplitContainer>(); 
     
                var dockState = RadDockPanel.GetDock(parent); 
     
                if (parent != null && dockState == Dock.Top) 
                { 
                    parent.MaxHeight = 150; 
                } 
            } 

    Hope this helps.

    Sincerely yours,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  10. Riccardo
    Riccardo avatar
    36 posts
    Member since:
    Apr 2009

    Posted 09 Jun 2009 Link to this post

    Sorry but RadPane load event I think is raised only when RadPane ends to be loaded.
    I need an event for every time RadPane change its dock status.
    I'm working to do it based on SizeChanged event.


  11. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 10 Jun 2009 Link to this post

    Hello Riccardo,

    The RadPane Loaded event is firing every time you change its DockState. So there is no problem to put your logic in the Loaded event handler. Also, please make sure you have the latest internal binaries (version - 2009.1.605)

    Sincerely yours,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  12. Riccardo
    Riccardo avatar
    36 posts
    Member since:
    Apr 2009

    Posted 10 Jun 2009 Link to this post

    Ok thanks. It works. The event "Loaded" coincides with "SizeChanged" event... but the SizeChanged event not raised, when a pane is resized when is floating.
  13. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 15 Jun 2009 Link to this post

    Hello Riccardo,

    I'll explain some details about the architecture of the Docking control and I hope this will help you better understand when which event is fired and why.

    The Docking control contains SplitContainers and they contain PaneGroups. PaneGroups inherit from TabControl and they contain Panes that inherit from TabControlItem. The Pane has Header and Content part (like the TabControlItem) and the Header part is displayed in the TabStrip panel at the top of the TabControl. The actual Content of the TabItem is displayed in an area in the TabControl, because only one Pane's content is visible in any moment. As the TabControl hosts the Content of the TabItem, it is in the TabControl's visual tree. 

    The TabItem's visual representation is only the button with the header. It is not resized with the whole TabControl. This is the reason why the SizeChanged event of Pane is not fired when you resize the PaneGroup (as the PaneGroup is a TabControl and the Pane is a TabItem). The SizeChaged event is fired on the PaneGroup and on the Content of the currently selected Pane. If you need to handle this event we would recommend you to use the event of the Content of the Pane instead of the event of the PaneGroup as the groups are created and destroyed dynamically.

    Hope this information is helpful.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  14. Riccardo
    Riccardo avatar
    36 posts
    Member since:
    Apr 2009

    Posted 15 Jun 2009 Link to this post

    @Miroslav: thank you very much for you "hierarchical". Really interesting and useful!
  15. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 04 Sep 2009 Link to this post

    Hi,
    I also have an issue, can you please tell me how i can automatically resize the controls proportionally that i place within a RadPane, so that it is always in proportion and the whole set of controls in the pane are always shown no matter if you float the rad pane and reduce its size of increase it the set of controls will always look fit in and be in proportion?

    I am actually using the following hieriachy:
     a stackpanel to house my controls and the stackpanel is within
     a radpane, which is within
     a radpanegroup in within 
    a RadSplitContainer within
    a Raddocking.
  16. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 08 Sep 2009 Link to this post

    Hi,

    Thanks i got the answer u sent to me on my support ticket.

    Kingsey Magnus-Eweka  
  17. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 14 Sep 2009 Link to this post

    .
  18. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 14 Sep 2009 Link to this post

     Hi Miroslav,
    thank you   for the explanation of the archictecture of the rad docking control i now understand it quite a lot more now, but i have a very strange thing that is happening in my code le tme explain this very carefully...
    I have a raddock which has 5 Radsplit containers, each split container are docked Left, top, right bottom and center,
    I am actually using the format of the raddocking WeatherView example from the telerik Silver documentation
    " How to create weather forcast browser"

    now here is the sequence of what i am doing and what happens:
    within my Left splitcontainer i have 3 RadPaneGroups, i am using the topmost one for a test which is this:
    inside of  this top Left radgroup i have a radpane that contains a Grid that houses a Button and a RadChart

    like so:

     

    <telerikDocking:RadSplitContainer x:Name="rdSpltCtnrLeft" InitialPosition="DockedLeft" Orientation="Vertical"   MinWidth="350">

    <telerikDocking:RadPaneGroup x:Name="rdPnGrpTopLeft" MinHeight="232">

    <telerikDocking:RadPane x:Name="RadChartPane" Header="RadChart Data" telerikDocking:RadDocking.SerializationTag="RadChartPane" CanDockInDocumentHost="True">

       <telerikDocking:RadPane.Content>

         <Grid  x:Name="grdRadBarChart1">

             <Grid.RowDefinitions>

                <RowDefinition Height="Auto" />

       <RowDefinition Height="*" /> <!-- * is good but when you dock elseWhere there might be unlimited height check at work screen-->

             </Grid.RowDefinitions>

                <!--<Button Content="test stretch"></Button>-->

             <Button Content="Reload" Click="ReloadButton_Click"   VerticalAlignment="Top" HorizontalAlignment="Left" Style="{StaticResource ReloadButtonStyle}" Margin="1,1,0,0" Grid.Row="0"/>

    <controlChart:RadChart x:Name="rct"   VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="1,2,0,0" Grid.Row="1"/>

        </Grid>

       </telerikDocking:RadPane.Content>

    </telerikDocking:RadPane>

    </telerikDocking:RadPaneGroup>

    <!—Other radPaneGroups in the LeftSplitContainer-->

    <telerikDocking:RadPaneGroup>....</telerikDocking:RadPaneGroup>

    <telerikDocking:RadPaneGroup>....</telerikDocking:RadPaneGroup>

    <telerikDocking:RadPaneGroup>....</telerikDocking:RadPaneGroup>

    </telerikDocking:RadSplitContainer>

     when i move the radpane and go and dock it elsewhere... for example if i dock it to the top split container and then decide to re-dock it in its original position which was on the top left of the Left split container...i am no longer able to get to the grid contained in the radpane
    in C# codebehind code

    This is placed in the constructor of my silverlight page below

    public MainPage()

    {

     

       InitializeComponent();

       //......various initializations......

     

    this.RadChartPane.Loaded += (pane_Loaded);

    }

     

    private void pane_Loaded(object sender, RoutedEventArgs e)

            {

                var pane = sender as RadPane;

     

                if (pane.IsFloating)

                {

                   

    //set the default color to black so that it is the same as the rest of the radpanegroup background and not Gray...until a color is selected!

     

    pane.ParentOfType<RadPaneGroup>().Background = new SolidColorBrush(Colors.Black);

     

     //Set the Background of the Pane as it is floating to the currently selected color palette for all the groups

     

    pane.ParentOfType<RadPaneGroup>().Background = new SolidColorBrush(this.selector.SelectedColor);

                    return;

     

                }

                 

                //Get Pane's Parents and Grand Parents to the nth level

                var parentSptCtnr = pane.ParentOfType<RadSplitContainer>();

                var ParentGrp     = pane.ParentOfType<RadPaneGroup>();

     

                //check types...

                string parentType = null; 
                parentType = parentSptCtnr.GetType().ToString();

                parentType = ParentGrp.GetType().ToString();

     

                //*************reset Grid Row height to star when redocked in default position.*********/

                string paneName = pane.Name;

                Grid grid = (Grid)pane.FindName("grdRadBarChart1");

     

    //this now becomes null after docking the container Radpane back to its original position hence i cant access the grid or its RowDefinition to set it to "auto"

                if (grid != null)

                {

     

                    if (grid.RowDefinitions[1].Height.IsStar)

                    {

                        grid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Auto);

                    }

                }

               

                var dockState = RadDockPanel.GetDock(parentSptCtnr);

     

     

                if (parentSptCtnr != null && dockState == Dock.Top)

                {

                     

                }

     

                else if (parentSptCtnr != null && dockState == Dock.Bottom)

                {

     

                }

     

                else if (parentSptCtnr != null && dockState == Dock.Left)

                {

                     string paneName1 = pane.Name;

                     grid = (Grid)pane.FindName("grdRadBarChart1");

                    

                    

                }

                else if (parentSptCtnr != null && dockState == Dock.Right)

                {

     

                }

            }

     the point of what i am trying to do is to be able to access the grid in the radpane and set its second row definition  from "*" to "Auto" in code behind whenever the radpane is docked back to its original position this is to correct some formatting problems i am having

    I need to have the value second row definition of the grid to be set to " * " originally so that my button and radchart is displayed properly in the radpane as it's size is initially small but when i move the radpane and dock it elsewhere and then later re-dock it in the original place position the height becomes unlimited or infinity and does not display correctly so i need to set thhe RowDefinition back to "Auto" when the Radpane goes back to its original docking position to correct this.

    so my question is first of all when i dock the radpane back in the original position i can no longer access the Grid element within it in code ( i stepped through the sequence of code having moved the radpane docked it elsewhere and then docked it backin its default position...towards theend of the debugging sequence some how the Grid cannot be reached  

    the Grid now has a NULL value in c# code as stated in the  above line:
      
    if (grid != null) 

    furthermore I am not sure if i am trying to set the Grid.Rowdefinitions in the right event handler...i need an event that is fired when the Radpane is docked back in its original Radsplitcontainer, so that i can create an eventhandler for the Left SplitContainer which knows when a radpane has been removed from it and re-docked in it, but as you explained the radGroups are dynamically created and destroyed so i am not sure, if there will be such and event from the split container and how it will "know" if a radpane hase been docked to it...
    now i am not sure if a new splicontainer is created when this happens...i think not as the other radgroups in the left splitcontainer still exists so i need to know the whole sequence of what is dynamically created and destroyed and what does not get destroyed when my sequence of moving a radpane and docking it elsewhere and bringing it back to the original docked position happens..can you please explain the sequence and how i can resove this issue thanks!

    Kingsley

     

  19. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 15 Sep 2009 Link to this post

    Hi Kaloyan,

    I have tweeked you code a little bit....as there is a un forseen error that occurs... on the following line in you original code:
    var dockState = RadDockPanel.GetDock(parent); 

    this error will occur when you move a radpane from its docked position... to a new docked position
    if it is docked in an existing position you will get no error what soever
     but however if you move it to a new position which does not exist before
    i.e where a split container does not exist as this will generate a new split container and i am not sure but i think it will generate a new radpanegroup as well..here is the updated code:

    private void pane_Loaded(object sender, RoutedEventArgs e)

            {

                var pane = sender as RadPane;

     

                if (pane.IsFloating) return;

     

                var parent = pane.ParentOfType<RadSplitContainer>();

     

                //set to 0 to avoid error when docking pane outside another splitcontainer! as a new split  container is created and i think as well as a new radpanegroup

                //but how you get acces to this new Splitcontainer and radpanegroup which your pane will now exist in...i have no idea

                //is there a way to get access to the new splitcontainer and radpanegroup if indeed a radpane group is created as well

                Dock dockState = 0;

               

                if (parent != null && dockState == Dock.Top)

                {

                    dockState = RadDockPanel.GetDock(parent);

                }

               

                if (dockState == Dock.Top)

                {

                    parent.MaxHeight = 150;

                }

     

            } 

    so if you dont mind can you explain a couple of questions :
    firstly ,when a new RadSplitcontainer is created if a RadPaneGroup is also created for you radpane when moved to a new position
    secondly how do you get acces to the newly created RadSplitcontainer and RadPaneGroup ?
    as Miroslav explained also within this post that splitcontainer and RadpaneGroups are dynamically created and destroyed.

    thanks.

    it would be great to know exaclty the sequence of what is being created and destroyed dynamically and what stays the same when a radpane is moved from its docking position to a new position and then moved back to its original position (splitcontainer)

    1).when the radpane is removed what happens to its default splitcontainer  ? i.e are there any events fired?
    is the split container destroyed and re-created...which i think is unlikely as there might be other radpanegroups with radpanes in it..
    does it's size changed e.t.c

    2).we know that a new split container is created dynamically when you dock your radpane to a new position that does not have an existing splitcontainer, is a new radpanegroup created as well?

    3) how can we gain access to this new dynamically created SplitContainer and RadPaneGroup objects?

    4). when the radpane is then re-docked (put back) in its default splitcontainer what happens to the split container i.e are there any events fired?
    is the split container destroyed and re-created...which i think is unlikely as there might be other radpanegroups with radpanes in it..
    does it's size changed e.t.c

    if you can answer these questions this will clarify quite a lot of issues for a lot of people myself included.

    thank you
    Kingsley

  20. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 17 Sep 2009 Link to this post

    Hi Kingsley Magnus-Eweka,

    Thank you for the question you have posted. Recently we have added a new event in the RadDocking - PaneStateChange, that is fired whenever a RadPane is changing its state. So you can add an EventHandler to this event and get an instance for the RadPane using the code posted bellow:
    <radDock:RadDocking x:Name="dock" PaneStateChange="dock_PaneStateChange" .... 
    private void dock_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e) 
            { 
                var pane = e.OriginalSource as RadPane; 
                if(null != pane) 
                { 
                    var splitContainer = pane.ParentOfType<RadSplitContainer>(); 
                    var paneGroup = pane.ParentOfType<RadPaneGroup>(); 
                } 
            } 
    Also when a RadPane is docked somewhere else a new RadSplitContaier and RadPaneGroup is created dynamically and the old one is being destroyed. Let us know if you need something to be clarified

    Kind regards,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  21. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 18 Sep 2009 Link to this post

    Hi Kaloyan,
    Thanks  for adding the new event 'PaneStateChange' for the RadPane it will prove very very useful for a lot of handling for the Radpane.
     Yes there is still 2 more question... how do i get access to the new Instance of  RadSplitcontainer and its RadPaneGroup that is created when my Radpane is Docked somewhere else?

    And how do i get access to my Grid: 

    <telerikDocking:RadPane x:Name="RadChartPane" Header="RadChart Data" telerikDocking:RadDocking.SerializationTag="RadChartPane" CanDockInDocumentHost="True">

       <telerikDocking:RadPane.Content>

         <Grid  x:Name="grdRadBarChart1">

             <Grid.RowDefinitions>

                <RowDefinition Height="Auto" />

       <RowDefinition Height="*" /> <!-- * is good but when you dock elseWhere there might be unlimited height check at work screen-->

             </Grid.RowDefinitions>

                <!--<Button Content="test stretch"></Button>-->

             <Button Content="Reload" Click="ReloadButton_Click"   VerticalAlignment="Top" HorizontalAlignment="Left" Style="{StaticResource ReloadButtonStyle}" Margin="1,1,0,0" Grid.Row="0"/>

    <controlChart:RadChart x:Name="rct"   VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="1,2,0,0" Grid.Row="1"/>

        </Grid>

       </telerikDocking:RadPane.Content>

    </telerikDocking:RadPane>

    which is the content of my RadPane when i dock the RadPane in the original position?

    Please tryout the sample code i sent to you and try moving the radpane and docking it somewhere else and then try to dock it in its default position... if you put a breakpoint on it ..as you dock the radpane at the original default (the original splitcontainer it was in) position the grid  registers as NULL i dont know why this happens?

    The grid is a child of the RadpPane and should be available at all times regardless of where or what the radpane is doing i.e docking elsewhere, floating, resizing, pinned not pinned 
     

    can you show an example say within the pane_loaded EventHandler sample that you posted for Ricardo which is on the eight post of this topic?

    thanks
  22. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 21 Sep 2009 Link to this post

    Hi Kaloyan,

    Where and how do i access this particular build where you have added this updated new event in the RadDocking - PaneStateChange, that is fired whenever a RadPane is changing its state? I have looked at your most recent beta and it is not listed as one of the recently added stuff in RadDocking?

    thanks
    Kingsley
  23. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 21 Sep 2009 Link to this post

    Hi Kaloyan

    I finally found the download for the Latest internal build at :
    http://www.telerik.com/account/downloads/internal-builds.aspx?type=2&mvid=2079&pid=571

    unfortunately it does not work when i use these latest references

    i get the following Visual studio Messagebox error:

    an unhandled exception ('Unhandled Error in silverlight Application Code:4004
    Category: ManagedRuntimeError
    Message:System.NotSupportedException: Placing Docking in a panel or control that measures it with infinite width or height is not supported in the...

    possible debuggers:
    New instance of Visual studio 2008

    Kind regards
    Kingsley Magnus-Eweka

  24. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 22 Sep 2009 Link to this post

    Hello Kingsley Magnus-Eweka,

    I have tested the code posted  by you and it was working properly. To get a particular parent of some RadPane you can use the extension method - ParentOfType<T>. Check the code posted bellow:
    private void RadDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e) 
            { 
                var radPane = e.OriginalSource as RadPane; 
     
                if (radPane != null
                { 
                    var splitContainer = radPane.ParentOfType<RadSplitContainer>(); 
                    var splitPaneGroup = radPane.ParentOfType<RadPaneGroup>(); 
     
                    if (radPane.IsFloating && splitPaneGroup != null
                    { 
                        splitPaneGroup.Background = new SolidColorBrush(Colors.Red); 
                        return
                    } 
                    var paneContent = radPane.Content; 
                } 
            } 

    Also, it is not recommended to put a StackPanel or ScrollViewer as a parent of the RadDocking control as these layout controls measure their children with infinite size, which is causing the error. Let us know if you need some more explanations.

    Sincerely yours,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  25. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 25 Sep 2009 Link to this post

    Thanks Guys it works now...
    Still there is one thing i'd like to know .. I am trying to take it to the next level....is there a way of Docking a radPane and Undocking a radpane in code? i.e i cant seem to find a Method to Dock a radpane to a splitContainer or a RadPanGroup there  seem to be only Dockstate enum to tell you the State of the RadPane, RadPaneGroup and RadSplitcontainer's docked state,
    there does not seem to be a way to access the Object model of the raddocking hence i have very limited information of this control other than the documentation and that of the examples which does not give me much...
    for example 
    I want to add a functionality of when you click on a radpane docked to a Top, Left , right, bottom Splitcontainer i want it to instantly go and Dock itself in the Middle containter which is essentially the document Host, so that you can click on several radpanes and they will all go and dock in the document host and you can then click on each of their tabs to see which one you want in a bigger view...essentially the documenthost then acts like a main viewer screen....yes i know there is a MoveToDocumentHost() of the radpane that does this....but i dont find a method that does the reverse...because at some point the user might want to click on a radpane in the Documenthost and want that radpane to return back to where itwas previously Docked...is there a way of doing this ?

    Thanks Kingsley
  26. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 26 Sep 2009 Link to this post

    Hi Kingsley,

    To move RadPane to DocumentHost you could use its method MoveToDocumentHost (as you correctly noticed). When you call it you could save where the pane was (its group) to the Tag property for example. When you want to move it back you could use the following method that moves a RadPane to a specified group:
    private static void MovePaneToGroup(RadPane pane, RadPaneGroup targetGroup) 
        if (pane.IsPinned && pane.Parent != targetGroup) 
        { 
            pane.RemoveFromParent(); 
            targetGroup.Items.Add(pane); 
        } 

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  27. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 28 Sep 2009 Link to this post

    Hi Miroslav,
    thanks for your speedy reply and fantastic suggestion, now how do i  save my RadPane to the tag Property of the RadePaneGroup it belongs i cant find anything on that in the documentation, can you show a code sample thanks.
  28. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 Sep 2009 Link to this post

    Hello Kingsley,

    The idea is to use the Tag property to store the group that originally contains the pane just before moving in the DocumentHost. Here is an example:
    private static void MovePaneToDocumentHost(RadPane pane) 
        pane.Tag = pane.Parent; 
        pane.MoveToDocumentHost(); 
     
    private static void ReturnPaneToGroup(RadPane pane) 
        RadPaneGroup group = pane.Tag as RadPaneGroup; 
        if (group != null
        { 
            MovePaneToGroup(pane, group); 
        } 
     
    private static void MovePaneToGroup(RadPane pane, RadPaneGroup targetGroup) 
        if (pane.IsPinned && pane.Parent != targetGroup) 
        { 
            pane.RemoveFromParent(); 
            targetGroup.Items.Add(pane); 
        } 

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  29. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 29 Sep 2009 Link to this post

    Hi Kaloyan,
    Can you tell me the best way to make sure my silverlight application resizes correctly regardless of the size of my Monitor  or browser settings so that my users can still view the application correctly? that was actually why i had put ScrollViewer as a parent of the RadDocking control...put as you said and as i found out this gives infinite height value..so what would be the appropriate way?

    would it be using a Grid as the parent of my RadDocking (That is what i am currently using) but i still need a way for my application to re-flow and resize correclty regardless of the size of the screen or browser type being used to view it, your brilliant suggestions are welcome.

    thanks Kingsley
  30. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 29 Sep 2009 Link to this post

    Hi Kaloyan,
    just to Add Silverlight recommends the <Canvas> element MUST be the Top-level container for page Scaling and then you can adjust the page width and height accordingly in code like so:

    but since i cant use a container that will give my raddocking infinite height, which Canvas, scrollViewer, StackPanel will obviously do as per the error which container can i now use the grid is no good as it clips some of my controls, which is why silverlight recommends Canvas but since, you guys have now updated the raddocking to through a runtime error whenever its parent is one of the above how do i now implement Page scaling properly ?

    as you can see i have commented out the scrollviewer and the Canvas which no longer works due to the infinite size runtime error either of them will produce..

     

    <

     

    UserControl x:Class="SLDashboardApp.MainPage">
      <!--<Canvas>-->

     

     

     

     

            <!--<ScrollViewer VerticalScrollBarVisibility="Auto">-->

     

     

     

                <

     

    Grid x:Name="LayoutRoot1" Visibility="Visible">
                        <telerikDocking:RadDocking x:Name="docking" Grid.Row="1" Background="Black">
                            ...........
                            ..........my contents,> splitcontaners,> radPaneGroups,> RadPanes, >Grid>other controls

     

                     </

     

    telerikDocking:RadDocking>

     

     

     

     

     

     

                <!--</Grid>-->

     

     

     

     

     

     

            </Grid>

     

     

     

     

     

     

         <!--</ScrollViewer>-->
        <!--</Canvas>-->

     

     

     

    </UserControl>

    thanks Kingsley

     

  31. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 29 Sep 2009 Link to this post

    Hello Kingsley,

    You can still set Width and Height to your Docking control and use ScrollViewer or  StackPanel with it. This will prevent the Docking control to be measured with infinite size (what doesn't work anyway and this is the reason why we throw runtime error).

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft banner