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

Floating Display Issue with Ax Interop Component

2 Answers 56 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Ning
Top achievements
Rank 1
Ning asked on 17 May 2017, 02:21 AM

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

2 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 19 May 2017, 10:46 AM
Hello Ning,

This is expected and it is WPF framework behavior - the Winforms content is not visible in transparent WPF Windows. However we have an example in our online XAML SDK repository that demonstrates how to workaround that behavior:
https://github.com/telerik/xaml-sdk/tree/master/Docking/WinFormsInsideDocking

Hope this helps. If you have any further questions - let us know.

Regards,
Kalin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Ning
Top achievements
Rank 1
answered on 22 May 2017, 02:30 AM

Dear Kalin

 I just follow the example and test it, now it has already worked well. Thanks for your support. 

Ragards.

Ning

Tags
Docking
Asked by
Ning
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Ning
Top achievements
Rank 1
Share this question
or