[RESOLVED] Run winform inside WPF window.-VBForums
Results 1 to 4 of 4

Thread: [RESOLVED] Run winform inside WPF window.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2013
    Posts
    58

    Resolved [RESOLVED] Run winform inside WPF window.

    Very new to xaml. Is it possible to place a window form inside a WPF window. I realize that winform controls can be used , but I'm talking about the whole form being placed in the WPF window. Thank you.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    95,440

    Re: Run winform inside WPF window.

    It seems an odd thing to do but a form is a control too so you can use it like any other control. You'd have to add it to the container at run time and you should set its TopLevel property to False.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    95,440

    Re: Run winform inside WPF window.

    That said, WPF is not Modern/Metro. You can publish XAML apps to the Store but they are not WPF. If this is genuinely a WPF app then this is the wrong forum for this thread and if it is a Store app then it's not WPF and you won't be able to load a Windows Form.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2013
    Posts
    58

    Re: Run winform inside WPF window.

    Thank you for the timely response. It is a WTP.
    So this is the code for a textbox.

    <WindowsFormsHost Margin="0,23,0.4,-23.2">
    <wf:TextBox x:Name="textbox1" Text="Hello World"/>
    </WindowsFormsHost>


    What would you use for a whole form?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.