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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 326k
  • Answers 326k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Prepared statements created by mysqli_prepare() are server-side prepared statements. When… May 14, 2026 at 1:48 am
  • Editorial Team
    Editorial Team added an answer There isn't an extra uptick. You just have nested quotations:… May 14, 2026 at 1:48 am
  • Editorial Team
    Editorial Team added an answer You'll need to cast your char pointer to an int… May 14, 2026 at 1:48 am

Related Questions

I have a context menu situated inside a User Control Resource. <UserControl.Resources> <ContextMenu x:Key=Menu1>
I am designing a WPF user control which contains other user controls (imagine a
I am currently working within a WPF user control (the root element of my
We are developing a UI Control in WPF to be consumed within an existing
I have an itemscontrol with a custom panel inside a usercontrol. The usercontrols size

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.