{"id":5042,"date":"2017-09-11T03:20:43","date_gmt":"2017-09-11T10:20:43","guid":{"rendered":"https:\/\/blogs.plm.automation.siemens.com\/t5\/Solid-Edge-Blog\/How-to-Use-the-SEDraftX-Control-in-a-WPF-Application\/ba-p\/431649"},"modified":"2026-03-26T07:29:47","modified_gmt":"2026-03-26T11:29:47","slug":"how-to-use-the-sedraftx-control-in-a-wpf-application","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/solidedge\/how-to-use-the-sedraftx-control-in-a-wpf-application\/","title":{"rendered":"How to Use the SEDraftX Control in a WPF Application"},"content":{"rendered":"<p><P><STRONG>Prolog<\/STRONG><\/P><br \/>\n<P>&nbsp;&nbsp;<\/P><br \/>\n<P>Designers who use custom programs for automating their routine design tasks that also need to interact with Solid Edge are constantly exploring newer platforms like the .Net based Windows Forms or ASP.Net and lately the new <a href=\"https:\/\/en.wikipedia.org\/wiki\/Windows_Presentation_Foundation\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Windows Presentation Foundation<\/A> or simply WPF.<\/P><br \/>\n<P>&nbsp;<\/P><br \/>\n<P>Whereas hosting a Solid Edge ActiveX control like the SEPartX and SEDraftX are easily&nbsp;accomplished in a Windows Forms Application by drag-dropping from the Toolbox, the <a href=\"https:\/\/community.plm.automation.siemens.com\/t5\/Solid-Edge-Developer-Blog\/How-to-use-SEPartX-ocx-in-ASP-NET-web-application\/ba-p\/344210\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">last installment<\/A> by&nbsp;<a href=\"https:\/\/blogs.plm.automation.siemens.com\/t5\/user\/viewprofilepage\/user-id\/4887\" target=\"_blank\" rel=\"noopener\">@ksbhadekar<\/a>&nbsp; showed how to use these controls in a ASP.Net web application.<\/P><br \/>\n<P>&nbsp;<\/P><br \/>\n<P><U>This article further shows how to use the Solid Edge SEDraftX control in a WPF application<\/U>.<\/P><\/p>\n<p><P>In this article:<\/P><br \/>\n<P>&nbsp;&nbsp;<\/P><br \/>\n<UL><br \/>\n<LI>Prolog<\/LI><br \/>\n<LI>Obtaining the ActiveX Control Wrapper: The Easy Way<\/LI><br \/>\n<LI>Creating the ActiveX Control Wrapper: Under the Hood<\/LI><br \/>\n<LI>Hosting the ActiveX Control in a WPF Window<\/LI><br \/>\n<LI>Interacting with the ActiveX Control in WPF<\/LI><br \/>\n<LI>Tip-Tricks<\/LI><br \/>\n<LI>Epilog<\/LI><br \/>\n<\/UL><\/p>\n<p><P>Unlike a Windows Forms Application, the SEDraftX ActiveX control cannot be drag-dropped from the toolbox on to a WPF window. A wrapper is required to host a ActiveX control in WPF and there are two ways to obtain this wrapper.<\/P><\/p>\n<p><P><STRONG>Obtaining the ActiveX Control Wrapper: The Easy Way<\/STRONG><\/P><\/p>\n<p><P>The name is <EM>AxInterop.SEDRAFTXLib.dll<\/EM> and is readily available in the C:Program FilesSolid Edge STxProgram folder.<\/P><\/p>\n<p><P>Note: [bulb .PNG] If you are interested in knowing how you can generate this wrapper to expand your knowledge base, continue reading, else skip to the section &#8211; <EM>Hosting the ActiveX Control on a WPF Page<\/EM>.<\/P><\/p>\n<p><P><STRONG>Creating the ActiveX Control Wrapper: Under the Hood<\/STRONG><\/P><\/p>\n<p><P>The procedure for generating the wrapper for any ActiveX control is amply detailed in <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/framework\/wpf\/advanced\/walkthrough-hosting-an-activex-control-in-wpf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this Microsoft knowledge article<\/A> and in a nutshell, here\u2019s the process for the Solid Edge SEDraftX control:<\/P><\/p>\n<p><OL><br \/>\n<LI>Create a new Windows Forms Application.<\/LI><br \/>\n<LI>Add the SEDraftX control to the toolbox. To do this go to the General tab or any empty tab in the toolbox and right-click in the empty space in the tab. Then select Choose Items\u2026 from the context menu that appears.<\/LI><br \/>\n<\/OL><\/p>\n<p><P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 255px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf01-1.png\" width=\"255\" height=\"346\" alt=\"wpf01.png\" title=\"wpf01.png\" \/><\/span><\/P><\/p>\n<p><OL><br \/>\n<LI>In the dialog that appears next, take the COM Components tab and scroll down to select the SEDraftX Control. Click OK.<\/LI><br \/>\n<\/OL><\/p>\n<p><P><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 544px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf02-1.png\" width=\"544\" height=\"156\" alt=\"wpf02.png\" title=\"wpf02.png\" \/><\/span><\/P><\/p>\n<p><OL><br \/>\n<LI>Drop the Solid Edge SEDraftX control on the Form:<\/LI><br \/>\n<\/OL><\/p>\n<p><P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 247px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf03-1.png\" width=\"247\" height=\"268\" alt=\"wpf03.png\" title=\"wpf03.png\" \/><\/span><\/P><\/p>\n<p><OL><br \/>\n<LI>Build the project and open the output folder; note the AxInterop.SEDraftXLib.dll which is the wrapper generated for use in WPF:<\/LI><br \/>\n<\/OL><br \/>\n<P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 198px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf04-1.png\" width=\"198\" height=\"173\" alt=\"wpf04.png\" title=\"wpf04.png\" \/><\/span><\/P><\/p>\n<p><P>Recollect from previous section, this is the same wrapper that comes readily with Solid Edge.<\/P><\/p>\n<p><P><STRONG>Hosting the ActiveX Control in a WPF Window<\/STRONG><\/P><\/p>\n<p><OL><br \/>\n<LI>Start a WPF Application and add a reference to <EM>SEDraftX.dll <\/EM>that was either built using the steps in previous section or the one directly in the Solid Edge Program folder.<\/LI><br \/>\n<\/OL><\/p>\n<p><OL><br \/>\n<LI>Add the namespace as shown below to the XAML part of the WPF project:<\/LI><br \/>\n<\/OL><br \/>\n<P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 538px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf05-1.png\" width=\"538\" height=\"132\" alt=\"wpf05.png\" title=\"wpf05.png\" \/><\/span><\/P><\/p>\n<p><OL><br \/>\n<LI>Drop the special <EM>WindowsFormsHost<\/EM> from the Toolbox on to the WPF\u2019s XAML Window and add the SEActiveX line as below:<\/LI><br \/>\n<\/OL><br \/>\n<P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 334px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf06-1.png\" width=\"334\" height=\"56\" alt=\"wpf06.png\" title=\"wpf06.png\" \/><\/span><\/P><\/p>\n<p><P><STRONG>Interacting with the ActiveX Control in WPF<\/STRONG><\/P><\/p>\n<p><P>The name MySEDraftX from XAML can be used in the code-behind using VB.Net or CSharp to access the properties of the SEDrfatX control as below:<\/P><\/p>\n<p><P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 568px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf07-1.png\" width=\"568\" height=\"47\" alt=\"wpf07.png\" title=\"wpf07.png\" \/><\/span><\/P><\/p>\n<p><P><STRONG>Tip-Tricks<\/STRONG><\/P><\/p>\n<p><P>When the WPF window is resized, the Draft file graphics may not update with it.<\/P><\/p>\n<p><P>&nbsp;<span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 323px;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf08-1.png\" width=\"323\" height=\"215\" alt=\"wpf08.png\" title=\"wpf08.png\" \/><\/span><\/P><\/p>\n<p><P>To overcome this problem, use the Resize event of the WPF window as below:<\/P><\/p>\n<p><P><STRONG><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 902px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/wpf09-1.png\" alt=\"wpf09.png\" title=\"wpf09.png\" \/><\/span><\/STRONG><\/P><\/p>\n<p><P><STRONG>Epilog<\/STRONG><\/P><\/p>\n<p><P>Windows Presentation Foundation or simply WPF is the latest development platform from Microsoft which is specifically released for a rich and polished user interface.<\/P><\/p>\n<p><P>This in-depth and meticulously written article shows the various techniques to display Solid Edge Part, Draft and Assembly files with all its glitter and glory in the WPF UI.<\/P><\/p>\n<p><P>The contents and code samples provided can be freely used as a knowledge base for all future developments projects that use WPF with Solid Edge.<\/P><\/p>\n<p><P>~Tushar Suradkar<\/P><br \/>\n<P><SPAN><SPAN><SPAN><span class=\"lia-inline-image-display-wrapper lia-image-align-inline\" style=\"width: 37px;\"><img decoding=\"async\" src=\"http:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/fb-9.png\" alt=\"fb.png\" title=\"fb.png\" \/><\/span><\/SPAN><\/SPAN><\/SPAN><a href=\"https:\/\/www.facebook.com\/groups\/solidedgeusers\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Solid Edge Users Facebook Group<\/A>&nbsp;<STRONG>&#8211; Let&#8217;s Sync<\/STRONG><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prolog<br \/>\n&nbsp;<br \/>\n Designers who use custom programs for automating their routine design tasks that also need to interact with Solid Edge are constantly exploring newer platforms like the .Net b&#8230;<\/p>\n","protected":false},"author":42979,"featured_media":5073,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1,96],"tags":[33],"industry":[],"product":[],"coauthors":[],"class_list":["post-5042","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-tips-tricks","tag-developer"],"featured_image_url":"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/8\/2019\/09\/fb-9.png","_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/5042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/users\/42979"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/comments?post=5042"}],"version-history":[{"count":11,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/5042\/revisions"}],"predecessor-version":[{"id":5074,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/posts\/5042\/revisions\/5074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/media\/5073"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/media?parent=5042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/categories?post=5042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/tags?post=5042"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/industry?post=5042"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/product?post=5042"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/solidedge\/wp-json\/wp\/v2\/coauthors?post=5042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}