Control Docking

7 posts, 0 answers
  1. Fabrizio Berardi
    Fabrizio Berardi avatar
    2 posts
    Member since:
    Apr 2009

    Posted 04 Jun 2009 Link to this post

    Hi,

    I have a RadPanel with two controls on it, one is a RadGrid, the other is a Panel with some other controls on, which is made visible or invisible by the user.

    I would like the RadGrid to fill the available space in the RadPanel, i.e to fill the whole panel when the other control is hidden or fill up to the other control when it is visible.  Currently when I set the GridView.Dock to Fill it fills the whole panel and other control is on top of it.

    I am sure there is a simple way or property setting to sort this, could someone let me know asap as I am trying to finish this today.

    Kind regards
  2. erwin
    erwin avatar
    358 posts
    Member since:
    Dec 2006

    Posted 04 Jun 2009 Link to this post

    I would suggest placing the two controls in a standard .net TableLayoutPanel control that sits on top of the RadPanel. Configure the TableLayoutPanel to be transparent and to Dock/Fill the RadPanel. Configure the Table for 2 rows and 1 colunmn.
    Place the grid in one row and the Panel in the other. Now configure the row with the panel in it to AutoSize.
    Configure the Grid to Dock/Fill the entire other row.

    Now you should have the desired behaviour, if you resize the RadPanel, its contents should resize as desired. Depending on your needs, you might want the contained RadPanel to Dock to the bottom of its containing TableLayoutPanel row.

    You will have to fiddle a little bit with the BackgroundColor settings and Margin/Padding settings. Having the gradient of the RadPanel shine through several layers of transparent controls seems to slow down the painting of the controls considerably.

    Regards
    Erwin
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 05 Jun 2009 Link to this post

    Erwin, thank you for this advise. You could use a simple Panel control or a Splitter instead of TableLayoutPanel. It depends on your application though.

    Fabrizio, if you need further assistance please write us back. We will be glad to assist you.

    All the best,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Fabrizio Berardi
    Fabrizio Berardi avatar
    2 posts
    Member since:
    Apr 2009

    Posted 09 Jun 2009 Link to this post

    Hi Jack,

    Could you explain how I can use the Panel or splitter controls as we are using Theming and using a standard .net control as Erwin suggests will not work ?

    Are you suggesting that each control goes into a panel and when these a set to Dock = Fill they do not overlay or underlay other panels on the same form / panel ?

    Thanks.

  6. erwin
    erwin avatar
    358 posts
    Member since:
    Dec 2006

    Posted 09 Jun 2009 Link to this post

    Hi Fabrizio,
    a TableLayoutPanel set to transparent should not interfere with your theming of the RadPanel below it.
    Erwin
  7. Prad
    Prad avatar
    35 posts
    Member since:
    Apr 2008

    Posted 09 Jun 2009 Link to this post

    I believe a simpler way is as follows:


    1. Panel Main -  Drop MainPanel. Set MainPanel.Dock = FIll
     2.  - RightPanel Contails your controls. Set RightPanel.Dock = Right/Left/Top/Bottom (Whatever).
      3.   LeftPanel Contains Grid. Set LeftPanel.Dock = Fill; Grid.Dock = fill
     
    In the runtime when you set RightPanel.Visible = false. You should be all good to LeftPanel with Grid....

    Note: Follow the above steps while droping panels.

    Jack view  of having Splitter is also a good way of going about.


    Pradeep
  8. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 10 Jun 2009 Link to this post

    Hi Fabrizio,

    Just follow the instructions from Pradeep. If you continue to have troubles with this, please send me your application. I will look at it and will try to find the best option.

    I am looking forward to your reply.

    Greetings,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for WinForms is Visual Studio 2017 Ready