0

I have a problem with input interoperation in WinForms and WPF.

Winforms/C#:

UserControlDLL.MyUserControl userControl = new UserControlDLL.MyUserControl();

public Form1()
{
    InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
    userControl.ShowTextBox();
}

WPF:

public partial class MyUserControl : UserControl
{
    internal static DisplayWindow display;

    public MyUserControl()
    {
        InitializeComponent();
        display = new DisplayWindow();
    }
}

When userControl creates the new DisplayWindow I can't enter anything in the textbox on the DisplayWindow.

Noam M
  • 3,156
  • 5
  • 26
  • 41

1 Answers1

1

Try this:

public Form1()
{
    InitializeComponent();

    ElementHost host= new ElementHost();
    host.Size = new Size(200, 100);
    host.Location = new Point(100,100);

    UserControlDLL.MyUserControl edit = new UserControlDLL.MyUserControl();
    host.Child = edit;

    this.Controls.Add(host);
}
Noam M
  • 3,156
  • 5
  • 26
  • 41