tags:

views:

214

answers:

6

One thing i noticed about WPF is that it combines various concepts from other computer languages i know, while other concepts are (were) completely new to me.

Experience in which languages can help WPF-newbies to understand the different WPF concepts?

For example if you know XSL, then DataTemplates will look familiar and the seperation of styling/UI/logic won't be new to people who did HTML/CSS/JavaScript before.

But what about things like Bindings, MarkupExtensions, Resources, RoutedEvents/Commands, Attached Properties, etc.

Is there a subset of languages that will help understand most WPF concepts? Which concepts are completely unique to WPF?


Update

So...besides HTML and XSL, there's only Cocoa out there that has a WPF-like concept? I understand that things like RoutedEvents are very much related to the WPF visual/logical tree structure, so unlikely to see in platforms that dont have a similar structure, but a concept like Attached Properties seems useful in many non-UI scenarios.

A: 

Well, Win32 underlies WPF and most win32 applications were written in c and c++, so c and c++ are some languages which might help you understand WPF.

Joe Soul-bringer
WPF is built on top of direct-x, but it's a complete abstraction of it, so it wouldn't help much to understand how direct-x works at all.
Michael Meadows
Agreed with Meadows. WPF doesn't seem to be a so-called leaky abstraction.
harms
+3  A: 

I know how you're feeling - I've just been through it myself. The language that helped me the most was actually plain old HTML - declaritive, tree-based, XML-like. When designing the UI, you have to keep in mind the natural tree structure of the elements because things like DataContext propegate down the tree.

If you've done any WinForms coding before, smash your head on a rock until you forget it.

If you find yourself doing stuff in the code-behind (blah.xaml.cs file) beyond setting data contexts and button-click handling, then you're doing it wrong. (Bindings can do pretty much everything)

I cant think of any other specific language that would help, however a book I can recommend is Windows Presentation Foundation Unleashed by Adam Nathan (pub. Sams).

geofftnz
I didn't really "get" WPF until I started to understand Bindings. It's really liberating to have so little code in the code behind! :)
Andy
There's definitely an "Ah-ha" moment that happens. Before then it's all brick-wall headbanging as you try to code WinForms via WPF.
geofftnz
+1  A: 

Not so much a language, but my experience with Swing helped me comprehend XAML's panel-based layout engine. Between that and global styles I'm never, ever having to put position or size information into any of the controls...

mjfgates
But I don't think the panel types of WPF are particularly difficult to grasp. The slightly more complex issues are things like bindings, routed events, dependency properties, logical and visual trees, data and control templates, resource dictionaries, and the overall "declarative" way it works.
harms
Yep, all those things are harder (except for "declarative"... THAT we had twenty years ago. We called it "DLGEDIT."). And yet, I've been watching my co-workers thrash around, using Expression Blend to drop controls in fixed places, wondering why nothing ever works if the user resized the window...
mjfgates
+1  A: 

Doing HTML/XHTML properly, or maybe general XML rendered with XSL/XSLT, is probably most similar.

It's very important to understand that WPF is designed through-out to allow a very "declarative" style of programming, where information is included in the XAML file that allows the runtime (or implicitly invoked libraries) to do the kind of "plumbing" work that you would otherwise have to type out hundreds of lines of code to do. Some WPF concepts may at first seem a little "baroque" (overly complicated), but in non-trivial applications I think they provide a great benefit.

I know that Mac OS X's Cocoa framework has bindings as well. But overall it's a very different system.

I agree that the Unleashed book is good. I've been reading it, and it has lucid and good explanations of the major topics.

harms
Thanks, didn't know about Cocoa, but while skimming through this http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/WhatAreBindings.html, the concept looks very similar to WPF bindings...what are the major differences in your opinion?
Bubblewrap
I didn't mean to imply great differences in the bindings as such, but all the other parts of the two systems seem very different. *How* they are different, is too big a topic for me to give a quick answer to :-)
harms
A: 

This question reminds me of a blog post I once read from Karsten Januszewski:

There are many similarities to other UI development paradigms: styles feel like CSS, well sort of. XAML code behind feels like ASP.NET, well sort of. 3D feels like DX or OpenGL, well sort of. Routed events feel like .NET events, well sort of. Dependent properties feel like properties, well sort of. The list could go on.

WPF has a steep learning curve, and in my opinion, that is the only thing stopping WPF from taking over the world!

Arcturus
+1  A: 

The question is a bit badly phrased in its use of the word languages because many concepts in WPF come from application frameworks, rather than languages.

The PowerPlant framework from Metrowerks, bundled in the CodeWarrior tool, was an excellent 3rd generation C++ framework for Macintosh. It, like many others, had the concept of a view hierarchy which was separate from the command escalation hierarchy. The binding of events or commands at any given level, with their default falling up to the next level, was provided by switch statements.

Andy Dent