Discussion Groups

All Discussion Groups » Autodesk DWF Viewer

Thread: DWF control in a .Net WPF


Permlink Replies: 3 - Last Post: Oct 8, 2009 8:52 AM Last Post By: JohanLarsson Threads: [ Previous | Next ]
edawgbrown

Posts: 10
Registered: 03/10/09
DWF control in a .Net WPF
Posted: Mar 18, 2009 1:56 PM
  Click to reply to this thread Reply
Has anyone been able to embed a DWF control into a .Net WPF form. I realize this is a COM component but was hoping someone had done this before.

Thanks in advance,

Ed
cammcad

Posts: 6
Registered: 04/08/09
Re: DWF control in a .Net WPF
Posted: Apr 9, 2009 6:54 PM   in response to: edawgbrown in response to: edawgbrown
  Click to reply to this thread Reply
Hi, you've probably already figured this one out. I've got this working in a WPF application.
It's fairly straightforward once you know all the steps to take. :-)

I started off just creating a winform user control and put the com object in it. as well as the logic for the viewer.
Then I created a new WPF application and dropped a WinformHost control on any standard wpf layout control. Grid, Canvas, StackPanel, etc.
Once that's done, just add a reference to the winform usercontrol you built (which has the viewer in it). then in code (not xaml) create an instance of the user control and add it as a child control to the host control. Something like ( winformsHost1.Child = usercontrol). That should get the viewer in WPF and allow the rest of your WPF app to respond to it's events, method calls, etc. One last thing... for some reason the viewer did not show up unless I compiled the WPF application to target x86 processor (which is located in project properties)

Hope that helps.
JohanLarsson

Posts: 331
Registered: 06/14/05
Re: DWF control in a .Net WPF
Posted: Oct 8, 2009 8:52 AM   in response to: cammcad in response to: cammcad
  Click to reply to this thread Reply


Hello,

Do you happen to have sample code for this that you can share?

/Johan

cammcad

Posts: 6
Registered: 04/08/09
Re: DWF control in a .Net WPF
Posted: Apr 9, 2009 6:57 PM   in response to: edawgbrown in response to: edawgbrown
  Click to reply to this thread Reply
forgot to mention, My development machine is x64 which is why I had to compile to x86.
So... if you're not on a x64 machine you're probably okay compiling to Any CPU.