2

I've been working on a project for some time, and it requires alphablended non rectangular forms... which in a little research I found can be easily done in WPF. So I decided to port my project from WinForms to WPF.

There are a few complications like a reference DLL based on WinForms I've been using doesn't work under WPF; it doesn't even show in the designer toolbox. I already tried loading it into the toolbox by right clicking and selecting Choose Items.., but it does not show there either.

I have never worked on WPF before, but it looks so promising for my requirements. So is there anything I could do to integrate my project into WPF?

J0e3gan
  • 8,740
  • 10
  • 53
  • 80
Suraj Bhawal
  • 403
  • 1
  • 6
  • 19
  • you may perhaps start from http://stackoverflow.com/questions/792279/what-is-wpf-for-the-winforms-programmer – pushpraj Sep 13 '14 at 07:45

1 Answers1

3

There is a control named 'WindowsFormsHost' in WPF. You can find it in toolbox. Drag it on the form and then you can use windows controls and user controls on it.

Hope this information will help.

pareto
  • 196
  • 5
  • thanks for the reply!! but how would i add controls into it? through code? sry for bothering but i'm new to c# and wpf – Suraj Bhawal Sep 13 '14 at 07:57
  • You need to create the object of the control and set it as a child to the host. For example DateTimePicker aDateTimePicker = new DateTimePicker(); wfTemp.Child = aDateTimePicker; – pareto Sep 13 '14 at 08:15
  • You can add them from the toolbox as well. Just drag the windows control and place it in the host area. – pareto Sep 13 '14 at 08:29
  • it wont work!! everything is done added control to the windowsformshost but the usercontrol i created wont run.. it wont react to any userinput keyboard or mouse – Suraj Bhawal Sep 13 '14 at 08:34
  • there arent any usercontrols i created... so i cant add them...also i cannot add winform controls through code.. like for example i want to add timer. it wont add – Suraj Bhawal Sep 13 '14 at 08:37
  • So you want to use timer for your program? – pareto Sep 13 '14 at 08:44
  • Here is a link that may be helpful in utilizing timer in wpf. http://stackoverflow.com/questions/5410430/wpf-timer-like-c-sharp-timer – pareto Sep 13 '14 at 08:45