Archive

Posts Tagged ‘WPF’

An Exercise in WPF - Part 1

April 17th, 2009

I figure it’s high-time I learn Windows Presentation Foundation (WPF). I’ve been putting it off long enough. I’ve given it a couple of tries in the past and ran away screaming. I would have thought that given my experience with Windows Forms and ASP.NET the transition would be easy, but it’s actually a totally different beast. I admit that it probably seems harder than it should because I’m so good at those other technologies that I can easily talk myself out of going through all the trouble of learning a new way to do something.

I think the other main reason I’ve avoided WPF until now is that I mostly program data-driven applications—the kind that Windows Forms excels at. I viewed WPF more as a way to dazzle consumers with its fancy graphics. Getting it to just display basic buttons, menus, list views, etc… seemed like a lot of work. I also have never been fond of the way it renders text. For that and other reasons I’ve avoided it.

However, I’m seeing more and more WPF adoption these days—even in business environments. Also with the rumor that Visual Studio 2010 will have a native WPF UI, I figure if it is good enough to run Visual Studio, it is good enough for anything I would do.

One of the first exercises most Windows developers usually take on is making a clone of the standard Windows Notepad application. It’s actually a great place to start learning any new language or framework. It teaches the basics of using standard controls like the Menu and TextBox, it requires hooking events and listening for notifications, it requires IO operations to load and save files, etc…. I did the same thing when I learned Windows Forms and I’ll do it again to learn WPF. You have to start somewhere. :)

One of the ways I thought I would motivate myself to keep pressing forward is to give regular updates here on the blog. So I’ve posted my first bit of Notepad in WPF code. It looks like Notepad, but that’s where the similarity ends. None of the menu items actually do anything yet. Hopefully over the next couple days and weeks I’ll continue to update the code and gain some experience.

Download: notepad-v01

Programming ,