Follow-up to My CONDG Grok Talk

by Aaron 24. December 2010 01:45

You could say that this is a little late for a follow-up.  You'd be right if you did say that.  I used to be punctual.  Then I got married.  Then I had a kid.  Yup.  I went from punctual, to fashionably late, to...well...just late I guess.

Anyway, I'm providing my slides from the presentation here as well as the sample code.  This time, I bound the properties so the pop ups display the message you type into the text box.

When I left that fateful, brief "presentation", I didn't really get the feeling that I conveyed the best way to determine whether you should use a trigger/action combo or a behavior.  Let me clarify that now.

Suppose you want several operations to happen based on some trigger.  You can attach multiple actions to a trigger.  I mentioned that, but didn't demonstrate it.  Actions should only perform a single operation.  So o problem, just assign a bunch of actions to the trigger.  Afterward though, you see that the actions execute in a different order each time you trigger them.  Uh oh!

There's a distinct possibility that they'll actually execute in the same order each time, but actions execute in a nondeterministic order so you can't guarantee it.  What's the solution?  Behaviors!  If you need several things to happen in the same order each time, all of those things should be wrapped up in a behavior.

What if you're relying on some kind of state information to be used and shared among actions?  You don't want to expose that in the XAML with a hidden property or something.  Again, the best solution is a behavior.  The behavior will maintain state.  Those steps that need to execute can reference the same state data in the behavior without exposing the internal workings of those execution steps.  That's encapsulation for the boys and girls at home that are paying attention.

So, if you came to the presentation, I hope that you got something out of it.  Whether you loved it, hated it, or thought, "meh," by all means, let me know.  I don't have any plans of ever doing it again, but I would love to get any feedback from those in attendance.

TriggerAndActionDemo.zip (896.89 kb)

CONDG_Behaviors.zip (21.1 mb)

Tags: , , ,

Giving Grok Talk Tonight at CONDG

by Aaron 9. December 2010 00:14

Tonight I'll be giving a Grok talk at CONDG.  I get 15 minutes to talk about Behavior in WPF.  That's all I'm going to say about the topic, otherwise there's no reason to watch it.

I'm not used to public speaking, so this should be an interesting experience.

If you watch it, please let me know what you think.  If people like my presentation, I may try doing a longer (more interesting?) presentation.

Tags: , , ,