0

I have a process that was written by WPF and I want to start it in my program. I used "process.start()" and its worked successfully. But now I want to start my process as a child of a form.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
M_Mogharrabi
  • 1,369
  • 5
  • 29
  • 57
  • 4
    Process can not be a "child" of a Form, as proces is a OS Kernel citizen, but Form is your app component. Please explain what you want to achieve. – Tigran Jul 20 '11 at 07:31

3 Answers3

1

Do you mean you have a usercontrol/form, and you want to display that in your application?

If so, see this link: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms

George Duckett
  • 31,770
  • 9
  • 95
  • 162
  • Hi George,i saw that link.but that was for wpf usercontrol however i have a wpf project with several xaml files and i want to open it in one of my windows as a child of that.is there any way to do that? – M_Mogharrabi Jul 23 '11 at 05:02
  • 1
    From the looks of things, it seems turning your xaml files into usercontrols is the only way to do it. – George Duckett Jul 25 '11 at 06:48
1

You can't start process as a child of a Form! Process is just another application that is running on the computer no matter if it was build in windows forms or wpf or even assembly language.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
Jalal Said
  • 15,906
  • 7
  • 45
  • 68
0

You may mean starting new form as a child from main form?

using (ChildForm form = new ChildForm())
     form.ShowDialog(this); // this refers to main form object
  • Look at how you instantiate the object – Alex R. Jul 20 '11 at 08:47
  • @Alex you mean the `form` object? I see that it hasn't a problem - the `Form` class implements `IDisposable`, so that it can be put in a `using` statement. Or you mean the `this`? I assume that this code is in one of the methods of the main form, so that it can call `ShowDialog(IWin32Window window)` method with a reference to itself. –  Jul 20 '11 at 08:57