Dear Amin
I just used RadDocking control as tabbed style to display different files for viewing on-line, but I have to use a Axinterop component as viewing engine that should be integrated with WindowsFormHost. If RadDocumentPane worked as tabbed document style, everything work well, but once I dragged RadDocumentPane to be Floating(just like MakeFloatingDockable command execution), the content in RadDocumentPane will disappear. If I changed RadDocumentPane to be Tabbed Document or drag it into a RadPaneGroup, it will be OK and the content will appear again.
I know that once we set RadDocumentPane to be floating dockable, RadDocumentPane will be changed to be ToolWindow, and ToolWindow will add a new SplitContainer and RadPaneGroup as Content, regard original RadDocumentPane will be one item of RadPaneGroup.
the details are as follows:
Code-Behind:
private RadDocumentPane NewViewPane()//Create a New RadDocumentPane
{
RadDocumentPane lCtrlViewPane = new RadDocumentPane();
lCtrlViewPane.SetBinding(RadDocumentPane.CanDockInDocumentHostProperty, new Binding() { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Path = new PropertyPath("CanDockInDocumentHost", new object[0]) });
lCtrlViewPane.SetBinding(RadDocumentPane.CanUserCloseProperty, new Binding() { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Path = new PropertyPath("CanUserClose", new object[0]) });
lCtrlViewPane.SetBinding(RadDocumentPane.CanFloatProperty, new Binding() { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Path = new PropertyPath("CanFloat", new object[0]) });
lCtrlViewPane.SetBinding(RadDocumentPane.CanUserPinProperty, new Binding() { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = this, Path = new PropertyPath("CanUserPin", new object[0]) });
lCtrlViewPane.HeaderTemplate = SPHONavigateGeneralUtilities.SetTitleTemplate(this.Image);//SetHeader and Title Template as Picture and TextBlock
lCtrlViewPane.TitleTemplate = SPHONavigateGeneralUtilities.SetTitleTemplate(this.Image);
lCtrlViewPane.Content = this.SetContent();//Set RadDocumentPane Content , WindowsFormsHost
lCtrlViewPane.DataContext = this;//Set RadDocumentPane DataContext with ViewModel
return lCtrlViewPane;
}
private object SetContent()
{
WindowsFormsHost lCtrlFormHost = new WindowsFormsHost();
this._2DControl = new SPHO2DCtrl();
lCtrlFormHost.Child = this._2DControl;
return lCtrlFormHost;
}
public static DataTemplate SetTitleTemplate(string pstrImage)
{
DataTemplate lobjDataTemplate = new DataTemplate();
FrameworkElementFactory lobjFactory = new FrameworkElementFactory(typeof(StackPanel));
lobjFactory.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
lobjFactory.SetValue(StackPanel.VerticalAlignmentProperty, VerticalAlignment.Center);
lobjFactory.SetValue(StackPanel.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
FrameworkElementFactory lobjFactoryImage = new FrameworkElementFactory(typeof(XamlImage));
lobjFactoryImage.SetValue(XamlImage.WidthProperty, 24.0);
lobjFactoryImage.SetValue(XamlImage.HeightProperty, 24.0);
lobjFactoryImage.SetValue(XamlImage.HorizontalAlignmentProperty, HorizontalAlignment.Left);
lobjFactoryImage.SetValue(XamlImage.VerticalAlignmentProperty, VerticalAlignment.Center);
lobjFactoryImage.SetValue(XamlImage.MarginProperty, new Thickness(5));
lobjFactoryImage.SetResourceReference(XamlImage.TemplateProperty, pstrImage);
lobjFactory.AppendChild(lobjFactoryImage);
FrameworkElementFactory lobjFacotryTextBlock = new FrameworkElementFactory(typeof(TextBlock));
lobjFacotryTextBlock.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center);
lobjFacotryTextBlock.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
lobjFacotryTextBlock.SetValue(TextBlock.MarginProperty, new Thickness(5));
lobjFacotryTextBlock.SetBinding(TextBlock.TextProperty, new Binding("Title"));
lobjFacotryTextBlock.SetResourceReference(Styling.FontStyleProperty, "TextStyle_Label1");
lobjFactory.AppendChild(lobjFacotryTextBlock);
lobjDataTemplate.VisualTree = lobjFactory;
return lobjDataTemplate;
}
//add new RadDocumentPane into a RadPaneGroup
this.CTRL_DISPLAYAREA.AddItem(lCtrlViewerAndModel.Pane, Telerik.Windows.Controls.Docking.DockPosition.Center);
public RadPaneGroup CTRL_DISPLAYAREA { get; set; }
XAML:
<telerik:RadDocking BorderThickness="0" Padding="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<telerik:RadDocking.DocumentHost>
<telerik:RadSplitContainer>
<telerik:RadPaneGroup x:Name="PNL_DISPLAYAREA" BorderThickness="0">
<telerik:RadDocumentPane HeaderTemplate="{StaticResource Panel_3DModelViewControl}" Title="{ui:SPEResources Id=SPHO_NAVIGATE_3DWINDOWS}" BorderThickness="0" CanUserClose="False" AllowDrop="False">
<Border SnapsToDevicePixels="True" Margin="3" BorderBrush="Gray" BorderThickness="1" CornerRadius="5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<wfi:WindowsFormsHost x:Name="WIND_3DHOST">
<localControl:SPHO3DCtrl ItemClick="SPHO3DCtrl_ItemClick" />
</wfi:WindowsFormsHost>
</Border>
</telerik:RadDocumentPane>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost>
</telerik:RadDocking>
Any suggestion do appreciate