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

WindowsFormsHost in RadWindow

22 Answers 554 Views
Window
This is a migrated thread and some comments may be shown as answers.
xu jundong
Top achievements
Rank 1
xu jundong asked on 05 Feb 2010, 08:31 AM
Hi, I have a problem while using RadWindow as the picture showing.
The two windows showed error!
The first window with a gray WinForm DataGridView in a WindowsFormsHost,
and the second window whit a red one.
AS the picture showing, the red window cannot display normally.
Is there any way to solve this problem?

Wish your help.
Thank you !

My xaml code:
<Page x:Class="WpfBrowserApplication9.Page1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Page1" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
          xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" 
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">  
    <Grid> 
        <my:RadWindow Name="radWindow1" VerticalAlignment="Top" > 
            <wfi:WindowsFormsHost Height="200" Width="300">  
                <wf:DataGridView x:Name="xy"></wf:DataGridView> 
            </wfi:WindowsFormsHost> 
        </my:RadWindow> 
        <my:RadWindow Name="radWindow2">  
            <wfi:WindowsFormsHost Height="200" Width="300">  
                <wf:DataGridView x:Name="xzy" BackgroundColor="Red"></wf:DataGridView> 
            </wfi:WindowsFormsHost> 
        </my:RadWindow> 
        <telerik:RadButton Height="23" HorizontalAlignment="Right" Margin="0,0,48,2" Name="radButton1" VerticalAlignment="Bottom" Width="75" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Click="radButton1_Click">Button</telerik:RadButton> 
    </Grid> 
</Page> 
and code behind:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
using System.Windows;  
using System.Windows.Controls;  
using System.Windows.Data;  
using System.Windows.Documents;  
using System.Windows.Input;  
using System.Windows.Media;  
using System.Windows.Media.Imaging;  
using System.Windows.Navigation;  
using System.Windows.Shapes;  
 
namespace WpfBrowserApplication9  
{  
    /// <summary>  
    /// Page1.xaml  
    /// </summary>  
    public partial class Page1 : Page  
    {  
        public Page1()  
        {  
            InitializeComponent();  
            radWindow1.Show();  
        }  
 
        private void radButton1_Click(object sender, RoutedEventArgs e)  
        {  
            radWindow2.Show();  
        }  
 
    }  

22 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 05 Feb 2010, 01:39 PM
Hi Xu Jundong,

 Unfortunately the WindowsFormsHost always appears above the WPF application and we don't know for a work-around for this problem.

Regards,
Miroslav Nedyalkov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
xu jundong
Top achievements
Rank 1
answered on 08 Feb 2010, 02:10 AM
Thanks for you answer!

That is realy bad news for me, because I will use some Winform Controls in my application.

As the RadDocumentPane control show this problem too, is there any other controls for this Solution?

Thank you!
0
xu jundong
Top achievements
Rank 1
answered on 08 Feb 2010, 06:29 AM
I see!
The WindowsFormsHost always appears above the WPF application, so I have to change my solution now.

Thank you!
0
Stefan Urabl
Top achievements
Rank 1
answered on 24 Feb 2010, 08:38 AM
Hello everyone

I have a similar problem, but my WindowsFormsHost is not displayed above, but not displayed at all, though the GUI is reacting to it.

I wanted to display a TX Textcontrol Editor element within a WpfWindow. With a standard WPF Window it worked fine (As shown in the attached file screenshot_wpfwindow.jpg).

My Code:
<Window x:Class="RSSoftware.WpfTextControlTest.WpfTextControlStandardWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:tx="clr-namespace:RSSoftware.WpfTextControlTest" 
    xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"  
    Title="TextControlWpfWindow" Height="800" Width="800"
    <Grid x:Name="grid1"
        <Grid.RowDefinitions> 
            <RowDefinition Height="Auto"/> 
            <RowDefinition/> 
        </Grid.RowDefinitions> 
        <Button Content="Fett" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Click="BoldButton_Click"/> 
        <Grid x:Name="TextControlGrid" Grid.Row="1"
            <wfi:WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                <tx:TxUserControl x:Name="TX"/> 
            </wfi:WindowsFormsHost> 
        </Grid> 
    </Grid> 
</Window> 
 

Now I wanted to display it in a RadWindow.

My Code:
<telerik:RadWindow x:Class="RSSoftware.WpfTextControlTest.WpfTextControlRadWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"  
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" 
    xmlns:tx="clr-namespace:RSSoftware.WpfTextControlTest" 
    Header="TextControlRadWindow" Width="800" Height="600" WindowStartupLocation="CenterScreen"
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="Auto"/> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <Button Content="Fett" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"  Click="BoldButton_Click"/> 
        <Grid x:Name="TextControlGrid" Grid.Row="1"
            <wfi:WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                <tx:TxUserControl x:Name="TX"/> 
            </wfi:WindowsFormsHost> 
        </Grid> 
    </Grid> 
</telerik:RadWindow> 
 

However, strange effects occured. As shown in the attached file screenshot_radwindow.jpg, the WindowsForms-element is not displayed. Remarkably, the element is still "there". If I move the Mouse over the area, the arrow switches to an input-sign and if i mark the area blind with the mouse, I can write text and copy it (With CTRL+C and CTRL+V) to an editor. The element is there, it is just not visible. I have tried to change the Visibility-Property and the Front- and Background-Colors of both the WindowsFormsHost and the UserControl, without a change.
I have also tried to replace the TxUserControl with a simple Windows Forms Label (wf:Label Text="Hello"), the same effect occurs, so it is not based on TextControl.

I want to use the RadWindow for getting a modern look with theming for the whole application and I hope someone here is able to help me.

Thanks in advance!

0
Miroslav Nedyalkov
Telerik team
answered on 24 Feb 2010, 09:02 AM
Hi Stefan,

 Unfortunately this is a limitation of the WPF WindowsFormsHost - when you put either the WebBrowser control or the WindowsFormsHost control into a window with AllowTransperancy property set to true, both controls are not visible. What I could suggest you is to use standard WPF window instead of using the RadWindow control for hosting the WindowsFormsHost control.

Sincerely yours,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Stefan Urabl
Top achievements
Rank 1
answered on 24 Feb 2010, 02:54 PM
Thanks for your reply.
Unfortunatly, I have to include a word processing component into my WPF-Application and use the modern Look & Feel of the themed telerik controls. When the WindowsHost is not usable, I am not able to use TextControl at the moment.
Do you know any other Editor for WPF I may use with the Telerik Components?
The RichTextBox included in WPF works with FlowDocuments but I have to edit FixedDocuments which should be prepared for printing. The editor must be able to handle tables, formats and templates.
Or is there a way to use a standard window and the borders and themes of the telerik elements?

Thanks in advance
0
Miroslav Nedyalkov
Telerik team
answered on 25 Feb 2010, 11:56 AM
Hello Stefan,

 If you use the WPF Window you will still be able to use the WindowsFormsHost control. The problem is when you need a window that allows transparency (that allows you to change its look and feel, like the RadWindow for example). If this is not important you could still use the RadControls for WPF and just not use the RadWindow control.

Hope this helps!

Kind regards,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Akram
Top achievements
Rank 1
answered on 28 Dec 2012, 06:16 PM
Hi
I have the same problem, the WindowsFormsHost does not appear at all inside RadWindow
i can't use the normal window, i have to use the RadWindow


Please let me know if there is a solution for this problem?

Thanks,
Akram
0
Miroslav Nedyalkov
Telerik team
answered on 02 Jan 2013, 09:32 AM
Hello Akram,

There is a feature of the RadWindow control that allows you to make the WPF window non-transparent. To do this you need to set the attached property WindowInteropHelper.AllowTransparency to false to the RadWindow control.

Hope this helps.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Akram
Top achievements
Rank 1
answered on 02 Jan 2013, 01:04 PM
Thanks, that's worked for me
0
Alan
Top achievements
Rank 2
answered on 25 Jan 2013, 08:06 PM
I don't see that property in the latest released binaries. Is it only available in an internal build? Could you please show a small snippet on how to set AllTransparency to false?
0
Miroslav Nedyalkov
Telerik team
answered on 28 Jan 2013, 09:57 AM
Hi Alan,

This property should be available with the official release as well. What version of RadControls for WPF do you use? Could you please verify if you added a reference to Telerik.Windows.Controls.Navigation, please?

Regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alan
Top achievements
Rank 2
answered on 28 Jan 2013, 02:14 PM
I'm using 2012.3.1129.45 and I am now able to use the property value after adding a reference to Telerik.Windows.Controls.Navigation.

Thank you.
0
Akram
Top achievements
Rank 1
answered on 28 Jan 2013, 02:19 PM
Hi Alan,

The WPF controls depend completely in the transparent feature, so if you disable this feature then you will loss most of the WPF's styles.

I know this is a bad news but Teleric must find an appropriate solution for this case.

Thanks,
Akram
0
Miroslav Nedyalkov
Telerik team
answered on 29 Jan 2013, 09:25 AM
Hi Akram,

Our themes are not designed for non-transparent host, so the will not look very nice if placed in such - you will need to do some more work for that. You also will need to disable the animations of the RadWindow control by setting the AnimationManager.AnimationSelector attached property to null.

We are aware of these shortcomings, but there is no way to resolve them, as we cannot animate the Win32 window with WPF animations and we cannot render partially transparent visuals when our host is not transparent.

Please let us know if something else is not working correctly in your case.

Regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
LittleDragon
Top achievements
Rank 1
answered on 17 Apr 2013, 06:23 AM
i have added winform controller on to WindowsFormsHost but when i run the application i cant see  winform controller
can any one help me /?
0
LittleDragon
Top achievements
Rank 1
answered on 17 Apr 2013, 08:12 AM

hi Akram
how you did this
WindowInteropHelper.AllowTransparency to false to the RadWindow control.   ???
0
Akram
Top achievements
Rank 1
answered on 17 Apr 2013, 09:51 AM
RadWindowInteropHelper.SetAllowTransparency(window,false);
0
LittleDragon
Top achievements
Rank 1
answered on 19 Apr 2013, 09:41 AM
hi Akram
 can u give me the email ID ?
0
Akram
Top achievements
Rank 1
answered on 19 Apr 2013, 10:45 AM
please put your email and i will replay to you

Thanks,
Akram
0
LittleDragon
Top achievements
Rank 1
answered on 19 Apr 2013, 11:43 AM
any one can help me /.?
0
LittleDragon
Top achievements
Rank 1
answered on 22 Apr 2013, 08:55 AM
im using VS 2008 i cant add new DLL any one can help me
Tags
Window
Asked by
xu jundong
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
xu jundong
Top achievements
Rank 1
Stefan Urabl
Top achievements
Rank 1
Akram
Top achievements
Rank 1
Alan
Top achievements
Rank 2
LittleDragon
Top achievements
Rank 1
Share this question
or