<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>WinForms on dwmkerr.com</title><link>https://dwmkerr.com/categories/winforms/</link><description>Recent content in WinForms on dwmkerr.com</description><generator>Hugo -- gohugo.io</generator><language>en-uk</language><managingEditor>Dave Kerr</managingEditor><copyright>Copright &amp;copy; Dave Kerr</copyright><lastBuildDate>Wed, 12 Jun 2013 01:36:18 +0000</lastBuildDate><atom:link href="https://dwmkerr.com/categories/winforms/index.xml" rel="self" type="application/rss+xml"/><item><title>WPF and Visual Studio Addins</title><link>https://dwmkerr.com/wpf-and-visual-studio-addins/</link><pubDate>Wed, 12 Jun 2013 01:36:18 +0000</pubDate><guid>https://dwmkerr.com/wpf-and-visual-studio-addins/</guid><description>&lt;p&gt;If at all possible nowadays, I write all my Windows UI code in WPF, it&amp;rsquo;s just quicker and easier than WinForms. Recently however, I came across a situation that you should just avoid.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re developing addins for multiple versions of Visual Studio - don&amp;rsquo;t use WPF for the Tools &amp;gt; Options windows. It&amp;rsquo;s just noit going to place nice out of the box. This is because there&amp;rsquo;s a lot of property page Win32 stuff going on in the host window that makes it hard to route messages properly - keyboard entry won&amp;rsquo;t work correctly, tab order will be messed up and more, it&amp;rsquo;s just not worth the pain.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re developing addins for later versions of Visual Studio, you can actually use the VSPackage functionality to build options pages with WPF with ease, just check &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.uielementdialogpage.aspx" target="_blank"&gt;UIElementDialogPage&lt;/a&gt;. In fact, read the article here:&lt;/p&gt;
&lt;p&gt;&lt;a title="Creating Option Pages by using MPF" href="http://msdn.microsoft.com/en-us/library/bb165039.aspx" target="_blank"&gt;Creating Options Pages by using MPF &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Final thoughts on this - if you want the functionality above in VS2010, you can get it (as long as you use MPF) by checking this page:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/6af9718e-8778-4233-875d-b38c03e9f4ba" target="_blank"&gt;Unable to access WPF User Control in Options Dialog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll see that about halfway down, Ryan Moulden has posted some code from Microsoft for the UIElementDialogPage, you can use that you get the functionality in VS2010.&lt;/p&gt;
&lt;p&gt;Any other versions, or for a addin installed by an MSI, it&amp;rsquo;s probably best to stick with WinForms.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description><category>CodeProject</category></item></channel></rss>