WindowsFormsHost in RadWindow

23 posts, 0 answers
  1. xu jundong
    xu jundong avatar
    20 posts
    Member since:
    Jan 2010

    Posted 05 Feb 2010 Link to this post

    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();  
            }  
     
        }  

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 05 Feb 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. xu jundong
    xu jundong avatar
    20 posts
    Member since:
    Jan 2010

    Posted 07 Feb 2010 Link to this post

    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!
  5. xu jundong
    xu jundong avatar
    20 posts
    Member since:
    Jan 2010

    Posted 08 Feb 2010 Link to this post

    I see!
    The WindowsFormsHost always appears above the WPF application, so I have to change my solution now.

    Thank you!
  6. Stefan Urabl
    Stefan Urabl avatar
    4 posts
    Member since:
    Feb 2010

    Posted 24 Feb 2010 Link to this post

    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!

  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 24 Feb 2010 Link to this post

    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.
  8. Stefan Urabl
    Stefan Urabl avatar
    4 posts
    Member since:
    Feb 2010

    Posted 24 Feb 2010 Link to this post

    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
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Feb 2010 Link to this post

    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.
  10. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 28 Dec 2012 Link to this post

    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
  11. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 Jan 2013 Link to this post

    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.

  12. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 02 Jan 2013 Link to this post

    Thanks, that's worked for me
  13. Alan
    Alan avatar
    47 posts
    Member since:
    Jun 2009

    Posted 25 Jan 2013 Link to this post

    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?
  14. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 Jan 2013 Link to this post

    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.

  15. Alan
    Alan avatar
    47 posts
    Member since:
    Jun 2009

    Posted 28 Jan 2013 Link to this post

    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.
  16. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 28 Jan 2013 Link to this post

    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
  17. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 29 Jan 2013 Link to this post

    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.

  18. LittleDragon
    LittleDragon avatar
    18 posts
    Member since:
    Apr 2013

    Posted 17 Apr 2013 Link to this post

    i have added winform controller on to WindowsFormsHost but when i run the application i cant see  winform controller
    can any one help me /?
  19. LittleDragon
    LittleDragon avatar
    18 posts
    Member since:
    Apr 2013

    Posted 17 Apr 2013 Link to this post


    hi Akram
    how you did this
    WindowInteropHelper.AllowTransparency to false to the RadWindow control.   ???
  20. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 17 Apr 2013 Link to this post

    RadWindowInteropHelper.SetAllowTransparency(window,false);
  21. LittleDragon
    LittleDragon avatar
    18 posts
    Member since:
    Apr 2013

    Posted 19 Apr 2013 Link to this post

    hi Akram
     can u give me the email ID ?
  22. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 19 Apr 2013 Link to this post

    please put your email and i will replay to you

    Thanks,
    Akram
  23. LittleDragon
    LittleDragon avatar
    18 posts
    Member since:
    Apr 2013

    Posted 19 Apr 2013 Link to this post

    any one can help me /.?
  24. LittleDragon
    LittleDragon avatar
    18 posts
    Member since:
    Apr 2013

    Posted 22 Apr 2013 Link to this post

    im using VS 2008 i cant add new DLL any one can help me
Back to Top
UI for WPF is Visual Studio 2017 Ready