tags:

views:

82

answers:

1

I am brand new in the world of Wpf, and am thinking it's time to get into it for my next project.

I'm a hardcore Winforms guy. Many of my projects perform tons of custom drawing - for example drawing a virtual baseball strike zone and then drawing icons to represent pitches thrown by a pitcher or seen by a batter. The pitches are interactive - the user can select one or multiple pitches (click, shift-click, rectangle drag) and then play video of the selected pitches.

I also have applications where I draw custom objects and then allow the user to drag them around and place them on a blank canvas.

I am trying to learn how one would do these types of things in the Wpf world. I got my first "hello world" graphic program working today, where I overrode ArrangeOverride and drew some lines on a blank window. But I've been reading about UIElement classes and Adorners and want to make sure I'm doing things "the right way". Should all my pitches be their own UIElements, for example?

I'm wondering if someone can guide me to some sample code or a book or article to get me started. If I could see "the right way" to create a custom drawn object (of any complexity, a simple rectangle would be fine), have the user select it (highlighting it somehow to show that it's selected) and then have the user drag it around the Wpf window, I would be well on my way.

+4  A: 

I also come from a WinForms background and the best book I've found is "Windows Presentation Foundation Unleashed" by Adam Nathan.

Amazon: http://www.amazon.com/Windows-Presentation-Foundation-Unleashed-WPF/dp/0672328917

It's a very XAML focused book. I feel is very important for a WinForms guy because you have to get out of the mindset that code controls your UI. XAML is kind in the WPF world and you need to get into the habbit of starting in XAML vs. code.

JaredPar
great suggestion - b/c I'm lost as to how XAML can help in these all-custom-graphics type user-interfaces. As I see it, XAML is the declarative description of your window - button here, listbox there. But the UI of my app isn't known till runtime - pull these 30 pitches out of the DB and draw them.
taglius
This is a really good book just finished reading it. Covers everything in a real world way unlike many microsoft books.
John