Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>(I apologize in advance for the long post ... there was just so much I wanted to convey ... I hope it helps you.)</em></p> <p>This is what we are doing now (migrating a Windows Forms application with heavy use of custom (GDI+) drawn controls to WPF). In fact, my role on the team was to build these GDI+ controls ... and now to build the WPF ones.</p> <p>I agree with Bijington that making your application completely 100% WPF from the ground up is the way to go ... if you can convince the powers that be to go that route. However, we ourselves are converting our Windows Forms application in-place, taking advantage of the <a href="http://msdn.microsoft.com/en-us/library/ms742522.aspx" rel="nofollow noreferrer">WPF interop</a> capabilities. There are some limitations, but overall it has been an effective approach (and not as frustrating as I would have expected).</p> <p><strong>What I would suggest is that you take one of your GDI+ controls and build the same control in WPF.</strong> And then, when you are finished, throw it away and do it again. You will invariably learn something during the first effort ... and discover that there is a better way to do it instead. I would start with something small ... a custom button is a good place to begin.</p> <p>Doing the above will give you a taste for what is going to be required for everything else you want to do.</p> <p>One thing I would warn you about is WPF's learning curve, especially if you are coming from a Windows Forms background ... and especially if you are going to be building custom looking controls. As Abe has mentioned, it is a completely different world. WPF definitely brings a lot of power, but that power comes at a cost of learning how to use it. Abe mentions how custom controls in WPF are 'lookless' and that their 'look' can be provided with a ControlTemplate. This is just one of many ways in WPF to provide custom looking pieces of your user interface.</p> <p>Let me enumerate some of those additional ways:</p> <ol> <li>Style an existing control using the styling capabilities of WPF.</li> <li>Take advantage of WPF's content model and/or controls derived from ContentControl. This allow you to stick arbitrary looking 'content' into visuals of a control (e.g. maybe sticking a custom drawn shape into the middle of a button).</li> <li>Compose a control out of other controls/elements by taking advantage of UserControl.</li> <li>Derive from an existing control/class in WPF, extending it's behavior and providing a different default set of visuals.</li> <li>Derive from FrameworkElement, creating a custom WPF element, by overriding some or all of the MeasureOverride, ArrangeOverride, and OnRender methods.</li> <li>And more .... if you can believe it.</li> </ol> <p>In Windows Forms, it was like they gave you a hammer (UserControl) and a screwdriver (Control). However, in WPF ... they have given you the whole toolbox with all 100 tools. And this is part of the reason for the bigger than normal learning curve. However, now you can take that saw that you never had before and use it to saw off the end of a 2x4 instead of using the hammer and/or screwdriver to try and do the same thing.</p> <h3>Resources</h3> <p><em>(The good news is that there are a lot out of resources out there to help you.)</em></p> <ol> <li><strong>Books</strong> <ul> <li>Programming WPF by Chris Sells &amp; Ian Griffiths (in particular, chapter 18)</li> <li>Pro WPF by Matthew MacDonald (in particular, chapter 24)</li> <li>WPF Unleashed by Adam Nathan (in particular, chapter 16)</li> <li>Applications = Code + Markup by Charles Petzold (in particular, chapters 10, 11, &amp; 12)</li> <li>Essential WPF by Chris Anderson (in particular, chapter 3)<br><br> My favorite books are Charles Petzold's book and Adam Nathan's book. However, chapter 18 of Programming WPF by Sells &amp; Griffiths is really great overview of the subject, and in particular coverage of the question: Do I really need a custom control?</li> </ul></li> <li><strong>Forums</strong> <ul> <li>The <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/threads/" rel="nofollow noreferrer">WPF Forum</a></li> <li>StackOverflow<br> Here are two posts in particular that you will want to take a look at (<a href="https://stackoverflow.com/questions/183315/what-are-the-best-resources-for-learning-wpf-net">one</a>, <a href="https://stackoverflow.com/questions/129772/how-to-begin-wpf-development">two</a>).</li> </ul></li> <li><p><strong>MSDN</strong><br> I agree with Bijington that the <a href="http://msdn.microsoft.com/en-us/library/ms754130.aspx" rel="nofollow noreferrer">MSDN documentation</a> excellent.</p></li> <li><p><strong>Blogs</strong><br> In <a href="https://stackoverflow.com/questions/129772/how-to-begin-wpf-development#154252">one</a> of the two StackOverflow posts that I reference in the Forums section above, I point to a set of blogs on my 'must read' list. In particular, I would especially point to the blogs of <a href="http://blog.pixelingene.com/" rel="nofollow noreferrer">Pavan Podila</a> and <a href="http://work.j832.com/" rel="nofollow noreferrer">Kevin Moore</a>. Kevin Moore used to be the WPF program manger for the WPF controls and he has a nice set of controls called the <a href="http://j832.com/bagotricks/" rel="nofollow noreferrer">WPF Bag-o-Tricks</a> that are useful, but more importantly, controls that you can learn from.</p></li> <li><p><strong>Samples, Samples, and more Samples</strong><br> There are just a ton of samples out there. Almost too many! I would point to <a href="http://www.codeplex.com/familyshow" rel="nofollow noreferrer">Family.Show</a> (it was created as an end-to-end reference sample for WPF) and I would point to the <a href="http://msdn.microsoft.com/en-us/library/ms771633.aspx" rel="nofollow noreferrer">WPF SDK samples</a> and in particular to the <a href="http://msdn.microsoft.com/en-us/library/ms771268.aspx" rel="nofollow noreferrer">Control Customization samples</a> within that section.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload