DropDownContent with WindowsFormsHost

3 posts, 0 answers
  1. Pov Ser
    Pov Ser avatar
    7 posts
    Member since:
    Nov 2009

    Posted 21 May 2014 Link to this post

    I'm using DropDownButton to display Winform or HWND window, but it seems that it does not display any Winform in DropDownContent

    Here is example:
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="MainWindow"
        Title="MainWindow" Height="350" Width="525">
            <telerik:RadDropDownButton Content="Browser" HorizontalAlignment="Left" Height="Auto" IsOpen="False" Margin="36,21,0,0" VerticalAlignment="Top" Width="Auto" DropDownWidth="800" DropDownHeight="600">
                        <Forms32:WebBrowser Url="google.com"></Forms32:WebBrowser>
            <telerik:RadDropDownButton Content="Button" HorizontalAlignment="Left" Height="Auto" IsOpen="False" Margin="129,21,0,0" VerticalAlignment="Top" Width="Auto">
                        <Forms32:TextBox Text="Test Text Box"></Forms32:TextBox>

  2. Zarko
    Zarko avatar
    755 posts

    Posted 26 May 2014 Link to this post

    Hi Pov,
    The problem is that WindowsFormsHost doesn't work in Popups with AllowsTransparency = True and by default we set it to true in code behind. What you can do is handle the loaded event and change it manually:
    private void OnDropDownButtonLoaded(object sender, RoutedEventArgs e)
        var dropDownButton = sender as RadDropDownButton;
        if (dropDownButton == null) return;
        var popup = dropDownButton.ChildrenOfType<Popup>().FirstOrDefault();
        if (popup != null)
            popup.AllowsTransparency = false;
    I hope I was able to help you.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Pov Ser
    Pov Ser avatar
    7 posts
    Member since:
    Nov 2009

    Posted 27 May 2014 Link to this post

    It works. Thank you kind.
Back to Top