Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 546741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:53:57+00:00 2026-05-13T10:53:57+00:00

I have a wpf Usercontrol, inside i am using a Winforms pdfviewer to display

  • 0

I have a wpf Usercontrol, inside i am using a Winforms pdfviewer to display pdf files. Also i have couple of Textboxes to enter document details. finally, A popup which display this user control.
The problem is, when i try to type something in textboxes, ntn is happenning. when i right click on a textbox, i can see context menu with cut, copy and paste options. After googling little bit, i found something like below, Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop(), I placed this line in loaded event but this is not working. can any one faced simillar issue and have any solutions.
Thanks.
Rey

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:53:57+00:00Added an answer on May 13, 2026 at 10:53 am

    I ran into this problem a while back. As I recall it was a bug having to do with the top level WPF message loop not playing nice with the WinForms message loop.

    The solution I used was to change my outermost layer from a WPF Window to a WinForms Form. In other words, I replaced

    new Window { Content = CreateContent(), Title = title }.Show();
    

    with

    new ElementHostForm(CreateContent(), title).Show();
    

    by using a class like this:

    class ElementHostForm : System.Windows.Forms.Form
    {
      ElementHost _host;
    
      public WinFormsWindow(UIElement content, string title)
      {
        _host = new ElementHost { Child = content };
        Controls.Add(host);
    
        content.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
        if(content.DesiredSize.Width > 100 && content.DesiredSize.Height > 100)
          ClientSize = _host.Size =
            new Size((int)content.DesiredSize.Width, (int)content.DesiredSize.Height));
    
        content.ClearValue(FrameworkElement.WidthProperty);
        content.ClearValue(FrameworkElement.HeightProperty);
    
        Title = title;
      }
    
      protected override void OnResize(EventArgs e)
      {
        if(!ClientSize.IsEmpty) _host.Size = ClientSize;
        base.OnResize(e);
      }
    }
    

    This worked around the bug by allowing WinForms to have the outermost message loop.

    This change was very easy for me because I already had my top-level content in a separate UserControl (not a Window). If your top-level content is a Window you may need to refactor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF usercontrol which contains a number of textboxes and buttons. Currently
I have a complex WPF UserControl made of other ContentControl templates which contain sets
I have a really simple WPF UserControl: <UserControl x:Class=dr.SitecoreCompare.WPF.ConnectionEntry xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Name=connEntry BorderBrush=Navy BorderThickness=1
In a WPF UserControl, I have to make to call to a WebService. I
I have several wpf pages with update/delete/add buttons. I want to display to the
I have a WPF window for editing database information, which is represented using an
This is weird. I have a UserControl (MyControl) with a button inside. I have
I have wpf UserControl containing a combobox and a textbox in a row. Currently
We have a WPF application that is loading a usercontrol at runtime from the
I have a WPF app with a usercontrol that contains a HwndHost. The HwndHost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.