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

Scrolling using WrapLayoutPanel

1 Answer 240 Views
ScrollablePanel
This is a migrated thread and some comments may be shown as answers.
David Storey
Top achievements
Rank 1
David Storey asked on 02 Nov 2010, 05:10 PM
Hi,

Ive created a custom control using the telerik controls, which is based on the "business card" example provided in the demo code. 
That is a RadControl that allows custom RadButtomElements to be added to it.  The RadButtonElements are stored in a WrapLayoutPanel.  However Im having difficulty getting scrolling to work properly.  Ive seen quite a few examples and threads about scrolling using the stacklayoutpanel, however I want to use the wraplayoutpanel to get better presentation, as each element is of variable size.  However using the wraplayout the scrollbars do not appear correctly.  At runtime it looks as though the viewport settings are calculated as if the viewport is a stacklayout not a wraplayout. 

Any help will be greatly appreciated.

Hopefully looking at this code will make a bit more sense...

Version of Rad controls (WinForm) 2009.3.9.1203
 

RadScrollViewer

 

scrollViewer = new RadScrollViewer();
 
Telerik.WinControls.UI.RadPanel radPanel1= new Telerik.WinControls.UI.RadPanel();

this
.Controls.Add(this.radPanel1);
WrapLayoutPanel
wrapLayout = new WrapLayoutPanel();

 

wrapLayout.Orientation =

Orientation.Horizontal;  

 

 

scrollViewer.Viewport = wrapLayout;

 

this.radPanel1.PanelElement.Children.Add(scrollViewer);  

for(int i = 0 ; i < 100; i++)  

{

wrapLayout.Children.Add(

 

new RadButtonElement() {Text = "Test" + i, Padding = new Padding(5), Margin = new Padding(2), Size = new Size(50,10)});  

}

 

 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 11 Nov 2010, 05:22 PM
Hello David,

Thank you for contacting us.

I confirum that we have an issue in our RadScrollViewer. It will be addressed in one of our next releases. For the time being, you can use RadScrollablePanel in a combination with FlowLayoutPanel. To do this, you need to make some calculations concerning the size of the RadScrollablePanel, the FlowLayoutPanel and the content in the FlowLayoutPanel. For better understanding, I am attaching a sample project which demonstrates the approach. I hope that it will help you to continue working on your scenario.

If you have additional questions, feel free to contact us.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ScrollablePanel
Asked by
David Storey
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or