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

Best way to suppress UserControl point when dragging HostWindow

2 Answers 77 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 10 Aug 2017, 02:24 AM

I'm using version 2017.2.613.40 of RadDock.

I'm using RadDock to host custom user controls by calling:

radDock.DockControl(_HostedControl, DefaultDockPosition, DockType.Document);

 

This creates a HostWindow.  It works great, however some of my user controls have somewhat expensive paint events.  For example, one is a chart which could have tens of thousands of data points and it can take a second or two to repaint the control.  Obviously, I'd like for this paint to be instant, but it's not.  It's what I'm stuck with for now.

My issue is when I try to rearrange DockWindows by dragging them to a different position in the RadDock and docking them there.  The dragging triggers repaints in the user control.  And the user control tries to repaint while it's being dragged.  This ends up stalling everything for a couple seconds several times during the drag.  This makes it not just annoying, but almost impossible to move DockWindows around which is one of the main reasons, of course, to use a RadDock in the first place.

My question is this:  what are the best RadDock or DockWindow events to subscribe to in order to disable my control when the drag starts and then to re-enable it after it gets re-docked at a new location in the RadDock.

Since these are custom controls, I have the ability to turn off painting or hide the control completely, I just need the right hooks to be able to do this at the right times.

Thanks,

Steve

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 10 Aug 2017, 06:51 AM
Hi Steve,

One way to solve this is to set the DragDropMode (see below). You can use the DragDropService events as well:
public RadForm1()
{
    InitializeComponent();
 
    this.radDock1.DragDropMode = DragDropMode.Preview;
    //or
    DragDropService service = this.radDock1.GetService<DragDropService>();
    service.Started += Service_Started;
    service.Stopped += Service_Stopped;
}
 
private void Service_Stopped(object sender, EventArgs e)
{
     
    radChartView1.Visible = true;
}
 
private void Service_Started(object sender, EventArgs e)
{
    radChartView1.Visible = false;
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Steve
Top achievements
Rank 1
answered on 11 Aug 2017, 08:56 PM

Thanks.  DragDropMode.Preview is a big help.

 

Tags
Dock
Asked by
Steve
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Steve
Top achievements
Rank 1
Share this question
or