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

RadDock - Dynamically adding UserControls with autoscroll

2 Answers 195 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Pawz
Top achievements
Rank 1
Pawz asked on 10 Sep 2009, 07:42 AM
How do I get this to work? I'm dynamically adding a UserControl to the Dock control, and I can't seem to get the docked window to get scrollbars to show up when it is resized.

CSUserControl itemControl; 
 
            if (typeof(CSUserControl).IsAssignableFrom(ucType)) 
            { 
                itemControl = (CSUserControl) Activator.CreateInstance(ucType, parameterList); 
            } 
            else 
            { 
                UserControl item = (UserControl)Activator.CreateInstance(ucType, parameterList); 
                 
                itemControl = new CSUserControl(); 
                itemControl.Controls.Add(item); 
                item.Dock = DockStyle.Fill; 
            } 
 
            Size size = itemControl.Size; 
            //Hook up events 
            itemControl.WindowChangeRequested += documentPane_WindowChangeRequested; 
            itemControl.WindowOpenRequested += documentPane_WindowOpenRequested; 
            itemControl.WindowCloseRequested += documentPane_WindowCloseRequested; 
 
            itemControl.AutoScroll = true
 
            HostWindow host; 
            if (dockPosition == DockPosition.Fill) 
            { 
                host = _dock.DockControl(itemControl, dockPosition, DockType.Document); 
            } 
            else 
            { 
                host = _dock.DockControl(itemControl, dockPosition); 
            } 
 
            
            host.Text = documentName; 
            host.Name = documentName; 
            host.CloseAction = DockWindowCloseAction.CloseAndDispose; 
            host.AutoScroll = true
            host.TabStrip.AutoScroll = true
            //host.TabStrip.MinimumSize = itemControl.MinimumSize; 
            //host.MinimumSize = itemControl.MinimumSize; 
 
            DockTabStrip strip = (DockTabStrip)host.TabStrip; 
            strip.SizeInfo.AbsoluteSize = size; 
            _dock.ActivateWindow(host); 

CSUserControl is simply a wrapper around the standard UserControl that gives me some extra functionality.

I've gotten it SORT OF working by using the commented out lines above - when I set the TabStrip AutoScroll  = true and the minimum size as well, then the scrollbars show up. BUT it's terrible in implementation - the tabstrip randomly disappears or repeats itself, scrollbars show up when they're not supposed to be, scrolling around wrecks the tabstrib.

How am I supposed to be doing this?

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 17 Sep 2009, 12:17 PM
Hello Pawz,

Please find the answer to your question in the support ticket regarding the same topic: Using Autoscroll with Docking windows.

Kind regards,
Nikolay
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.
0
MikeB
Top achievements
Rank 1
answered on 21 Oct 2009, 04:24 PM
Hi,

Besides setting the Form Autoscroll property to true, you also need to set the AutoScrollMinSize to the size that you want the scroll bars to appear.
Tags
Dock
Asked by
Pawz
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
MikeB
Top achievements
Rank 1
Share this question
or