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

Re-initializing control hosted in WindowsFormsHost causes contained control to no longer be docked in RadDockPanel

1 Answer 204 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 19 Dec 2013, 11:03 PM

I'm hosting an EDrawSoft OfficeOCX in a WindowsFormsHost. (MVVM, C#, .Net 4.0) The control fills a tab in a tab control in a Telerik RadDocPanel.

Everything is working very well, until someone tries to open a damaged Office document which throws an error and seems to corrupt the OfficeOCX control.

I've found that re-initializeing the OfficeOCX control gets it working again, except that the WindowsFormsHost no longer fills the tab. Simply resizing the application fixes it up again.

I've tried calling Refresh on the OfficeOCX control which didn't work, but it's probably not the control that needs to be refreshed.

The control is being manipulated in a PropertyChangedCallback for a dependency property. MSDN suggests calling WindowsFormsHost.InvalidateVisual() but that didn't work either.

My next attempt will be to try to call a method on the Telerik RadDockPanel to force the repaint...however I can't figure out how.


I have a resize event in the usercontrol that does nothing but allows me to set a break in it. When I resize the app, which fixes the docking problem, this event gets fired and the call stack shows it being called (through some external code) from:

Telerik.Windows.Controls.dll!Telerik.Windows.Controls.RadDockPanel.ArrangeOverride(System.Windows.Size finalSize)

Is there a way I can force this to happen from code?

Thanks

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 23 Dec 2013, 09:16 AM
Hi Kevin,

The panel which arranges the elements in the Docking control is called ProportionalStackPanel and it is in the ItemsPanelTemplate of the RadSplitContainer. So, in order to trigger arrange, you will have to call the Measure() method of the SplitContainer. Please, keep in mind that this might cause unexpected behavior:

private void Button_Click_3(object sender, RoutedEventArgs e)
{
     this.splitContainer.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}

Hope this helps.
Happy holidays!

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Docking
Asked by
Kevin
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or