Making it Easier to Write Behaviors
July 9th, 2009 | View Comments
Behaviors make it easier for designers to be able to do cool things that would otherwise require writing code. Of course, a behavior doesn’t just magically appear out of thin air.* It requires someone actually writing it.
While one our goals was to make it easy for someone to write a Behavior, there is a certain amount of boilerplate code that you need to be aware of before you get to writing code that is more familiar to you. To help make that process easier, we are going to be providing Item Templates that can be accessed from both Expression Blend 3 as well as Visual Studio 2008.
Here are the Action, Behavior, and Trigger item templates in Blend 3:

…and here they are in Visual Studio:
These item templates contain the boilerplate code I referred to earlier, so with a few clicks, you are up and running with something that Blend recognizes as a Behavior, Action, or Trigger
For example, here is what a Trigger looks like when created via our Item Template:
- public class Trigger1 : TriggerBase<DependencyObject>
- {
- protected override void OnAttached()
- {
- base.OnAttached();
- // Insert code that you want to run when the Trigger is attached to an object.
- }
- protected override void OnDetaching()
- {
- base.OnDetaching();
- // Insert code that you would want run when the Trigger is removed from an object.
- }
- //
- // To invoke any associated Actions when this Trigger gets called, use
- // this.InvokeActions(o) where o is an object that you can pass in as a parameter
- //
- }
We create all of the infrastructure code that makes your Trigger a trigger, and we also provide you with some helpful comments on what to do. Because our behaviors functionality requires referencing a DLL that we provide, that referencing step is taken care of automatically for you as well. Wouldn’t it be great if everything in life were as simple as this? Ok, I’ll stop now!
How this is Possible
Everything I’ve written above uses the Item Templates format documented on MSDN. What is new is how these templates get installed. We will be releasing in the near future a standalone Expression Blend SDK that makes it possible for you to create and redistribute the various new components we introduced as a part of Blend 3. You can read more about this on a blog post I wrote for the Expression Blend & Design team blog.
Cheers!
Kirupa
*That feature is currently being prototyped in an underground bunker in an undisclosed location.





July 10th, 2009 at 6:46 am
I want to know how to use SQL server 2005/08 with WPF. can you cover that if your next blog posts. It’ll help a lot.
July 10th, 2009 at 10:06 am
[...] improvements (for example, the direct selection improvements) … but what about behaviors (1, 2, 3)? Whoa! Can we say [...]
July 20th, 2009 at 10:34 pm
[...] Behavior Templates for Blend and Visual Studio – Kirupa shares some ItemTemplates to help when creating new Actions, Behaviors and Triggers [...]
July 29th, 2009 at 2:35 am
Great thing – but it doesn’t the item templates do not show up in localized versions of VS2008.
I wrote a short description how to fix this
http://manni-at.spaces.live.com/blog/cns!82CF2A6C0D0C6F3C!203.entry
July 30th, 2009 at 8:45 am
[...] Behavior Templates for Blend and Visual Studio – Kirupa shares some ItemTemplates to help when creating new Actions, Behaviors and Triggers [...]
July 30th, 2009 at 8:52 am
[...] Behavior Templates for Blend and Visual Studio – Kirupa shares some ItemTemplates to help when creating new Actions, Behaviors and Triggers [...]
August 3rd, 2009 at 4:44 pm
[...] Behavior Templates for Blend and Visual Studio – Kirupa shares some ItemTemplates to help when creating new Actions, Behaviors and Triggers [...]
September 19th, 2009 at 5:00 pm
[...] Behavior Templates for Blend and Visual Studio – Kirupa shares some ItemTemplates to help when creating new Actions, Behaviors and Triggers [...]
October 1st, 2009 at 3:26 pm
The VentureIntoGaming_ExpressionBlend3_StarterKit is password protected, any ideas?
January 10th, 2011 at 5:05 am
I am creating a behavior and would like to add a dependency that the user chooses and object off the story board with the target chooser. I can’t seem to figure out how to do this. Any direction you can point me in is apriciated.
March 5th, 2011 at 3:49 am
Heya! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup. Do you have any solutions to stop hackers?
http://www.cheapmusicsites.com
March 8th, 2011 at 7:55 am
Excellent information here. This attention-grabbing publish made me smile. Possibly when you throw in a couple of footage it’s going to make the entire thing more interesting. Anyway, in my language, there should not much good source like this.
March 8th, 2011 at 8:14 am
Thank you for the wise critique. Me & my neighbour had been making ready to do some research about that. We obtained a superb guide on that matter from our native library and most books where not as influensive as your information. I am very glad to see such information which I was searching for a protracted time.This made very glad! Anyway, in my language, there are not much good source like this.
March 8th, 2011 at 8:38 am
I was in search of crucial info on this subject. The knowledge was essential as I am about to launch my very own portal. Thanks for offering a lacking link in my business. Anyway, in my language, there usually are not a lot good source like this.
March 8th, 2011 at 8:46 am
Loved this post!! If we met that millionaire at the same time, beware. I can be ruthless, cunning, and stubbornly determined. All is fair in love and dream jobs. Selling my soul is not off the table.
March 9th, 2011 at 2:27 am
Hey cool blog, just wondering what anti-spam software program you use for comments as a result of i get heaps on my blog. Anyway, in my language, there usually are not a lot good source like this.
April 26th, 2011 at 4:25 am
How come my comment does not stick?
April 27th, 2011 at 3:35 am
Took me time cabbage soup diet to learn all of the comments, however I really enjoyed the article. It proved to be very useful to me and I’m certain to all of the commenters right here! cabbage soup diet It’s all the time nice when you cannot solely learn, but additionally engaged! I’m certain you had joy scripting this cabbage soup diet article. cabbage soup diet Anyway,cabbage soup diet in my language, there aren’t a lot good source like this.cabbage soup diet
May 3rd, 2011 at 8:09 am
I used to be linkwheel questioning if you would linkwheel like to be a visitor poster on linkwheel my web site? and in trade you may embody a hyperlink your post? linkwheel Please reply when you get an opportunity and I linkwheel will send you my contact particulars – thanks. Anyway, in my language, there aren’t linkwheel much good source like this.
May 5th, 2011 at 10:19 am
Aww, I hurt your tiny ego.
But anyway, Im curious as to where you picked up the first few insults from, that too in clear grammar. Impressive, for you I mean. Youre probably the first person Ive heard call himself a poet, Im not doing that (yes, in reference to Neruda. No one can be Neruda, asshole, not even you, or your mommy who writes poetry in a journal-and your probably thought you should give it a hand). Im just writing something, people call it free verse, I call them ideas.
May 20th, 2011 at 8:48 am
I’m a Sprouting Artist and loving it. I love to tell stories and I’m learning how as a student at BYU-I. I’m inspired by my peers, teachers and husband. I hope one of my images make you smile! Enjoy.
June 3rd, 2011 at 9:47 am
Thanks for some other wonderful post. Where else could anyone get that kind of information in such an ideal way of writing? I have a presentation next week, and I’m at the search for such information.
July 6th, 2011 at 8:44 am
I read with great interest.Thanks for you sharing.
July 6th, 2011 at 2:17 am
Hey there, You’ve done a great job. I’ll definitely digg it and personally recommend to my friends. I am sure they will be benefited from this web site.
July 7th, 2011 at 4:09 am
It appears that you’ve put a number of effort and onerous work into your post and I require far more of those on the web in current times. I sincerely obtained a kick out of your post. I don’t really have considerably to say responding, I only wanted to comment to answer amazing work.
July 11th, 2011 at 3:21 pm
I am interested to create a behavior. And also I would like to add a dependency that the user chooses and article off the adventure lath with the ambition chooser. It is a great thing.
link wheel creation
July 21st, 2011 at 11:55 pm
I’ve recently started a website, the information you provide on this website has helped me tremendously. Thank you for all of your time & work.
July 22nd, 2011 at 11:24 pm
This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your wonderful post. Also, I’ve shared your site in my social networks!
July 26th, 2011 at 11:04 am
Tanks for the item templates i found them pretty helpfull.
July 26th, 2011 at 8:38 am
appurtenant googled throughout to your site. sound is a path toto stunning doorpost. aye what I was attempting in that.
July 28th, 2011 at 9:11 pm
Just wish to say your article is as astonishing. The clearness in your post is just great and i could assume you’re an expert on this subject. Well with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please continue the rewarding work.
July 30th, 2011 at 1:52 pm
Thank you for the post, I don’t agree completely with it but I agree with it on the most part and I certainly applaud your effort in putting it so succinctly.
August 8th, 2011 at 2:53 pm
if they take Lucas and Peyton off the show is simply going to be cancelled who knws maybe theyl just be taking them off for the first few episodes
August 30th, 2011 at 6:41 pm
I admire the beneficial information and facts you provide in your posts. I will bookmark your blog and also have my children check up right here generally. I am fairly sure they’ll discover a lot of new things right here than anyone else!
September 1st, 2011 at 7:54 am
I love this . do you have fan facebook page for your site ?
September 1st, 2011 at 8:09 pm
I need to agree that this blog is worth all my time spent in studying it. Individuals posting weblog should really exert some effort to educating the readers.This would be the wonderful weblog for anyone who desires to find out about this subject.
September 6th, 2011 at 1:17 am
Thank you for that smart critique. Me & my neighbour were preparing to do some research about that. We obtained a great book on that matter from our local library and most books exactly exactly where not as influensive as your info. I am extremely glad to see such info which I was searching for a lengthy time.
September 10th, 2011 at 4:11 am
Truly liked going via this. Maintain it up!
September 13th, 2011 at 3:13 am
Thanks for good info. It’s helpful for me. Are you able to give me some more data with details? I will wait in your next post.
September 14th, 2011 at 2:58 am
I really treasure your piece of work, Great post.
September 15th, 2011 at 7:23 am
I am lucky that I discovered this website just the right information that I was searching for
September 16th, 2011 at 5:19 pm
Fantastic blog! Do you have any helpful hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely confused .. Any suggestions? Thanks!
September 19th, 2011 at 12:31 am
I like this weblog so much, saved to my bookmarks.
September 20th, 2011 at 11:39 pm
I recently came accross your website and possess been reading along. I was thinking I might leave my very first comment. Nice blog. Ill keep visiting this site very frequently. Thanks
September 24th, 2011 at 6:50 am
フィンペシア通販
フィンペシア通販
フィンペシア通販
フィンペシア通販
フィンペシア通販
フィンペシア通販
フィンペシア通販
プロペシア最安値
プロペシア通販
プロペシア通販
プロペシア価格
プロペシア価格
プロペシア価格
プロペシア 効果
プロペシア通販
プロペシア通販
フィンペシア通販
プロペシア購入
プロペシア通販価格
Thank you. Very helpful.924
プロペシア副作用
プロペシア通販
ロゲイン通販
September 24th, 2011 at 6:51 am
ミノキシジルタブレット
ミノキシジルタブレット通販
ミノキシジル
ミノキシジルタブレット通販
濃密育毛剤BUBKA(ブブカ)効果
濃密育毛剤BUBKA(ブブカ)体験談
育毛剤BUBKA(ブブカ)
ロゲインの口コミ評判
ロゲイン通販業者比較
プロペシア通販
プロペシア通販
プロペシア通販
プロペシア薬価
プロペシア飲み方
プロペシア耐性
プロペシア副作用
ロゲイン 通販
ロゲイン通販業者比較
フィンペシア
フィンペシア通販
育毛剤
育毛剤 比較
発毛剤
カークランド通販
カークランド
カークランドの通販
フィンカー通販
フィンカー通販
ゼニカル 購入
ゼニカル 最安値
ゼニカル購入
ED治療薬 比較
ED治療薬 通販
レスベラトロール サプリメント
レスベラトロール 効果
658
アサイー の効果
アサイー スーパーフルーツ
アサイージュース
育毛サプリ ファーミア・ヘアー
0066
ほうれい線対策 豊麗
ほうれい線 消す
性交痛 原因
性交痛 ゼリー
November 2nd, 2011 at 12:03 pm
A powerful share, I simply given this onto a colleague who was doing slightly analysis on this. And he in actual fact bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love reading more on this topic. If attainable, as you grow to be expertise, would you mind updating your blog with more details? It’s extremely useful for me. Large thumb up for this blog put up!
March 17th, 2012 at 3:59 am
A covey of parents are writing on the similar position owing to this one, however unconditional is completed in a special passage here. aliment corporal up.
April 5th, 2012 at 9:03 am
[...] The project could have far reaching implications for a variety of fields. The Massachusetts Institute of Technology (MIT) is leading an ambitious new project to reinvent how robots are designed and produced. Funded by a $10 million grant from the National Science Foundation (NSF), the project will aim to develop a desktop technology that would make it possible for the average person to design, customize and print a specialized robot in a matter of hours. “This research envisions a whole new way of thinking about the design and manufacturing of robots, and could have a profound impact on society,” said MIT Professor Daniela Rus, leader of the project and a principal investigator at the MIT Computer Science and Artificial Intelligence Lab (CSAIL). “We believe that it has the potential to transform manufacturing and to democratize access to robots.” “Our goal is to develop technology that enables anyone to manufacture their own customized robot. This is truly a game changer,” said Professor Vijay Kumar, who is leading the team from the University of Pennsylvania. “It could allow for the rapid design and manufacture of customized goods, and change the way we teach science and technology in high schools.” The five-year project, called “An Expedition in Computing for Compiling Printable Programmable Machines,” brings together a team of researchers from MIT, the University of Pennsylvania and Harvard University, and is funded as part of the NSF’s “Expeditions in Computing” program. It currently takes years to produce, program and design a functioning robot, and is an extremely expensive process, involving hardware and software design, machine learning and vision, and advanced programming techniques. The new project would automate the process of producing functional 3-D devices and allow individuals to design and build functional robots from materials as easily accessible as a sheet of paper. “Our vision is to develop an end-to-end process; specifically, a compiler for building physical machines that starts with a high level of specification of function, and delivers a programmable machine for that function using simple printing processes,” said Rus. Researchers hope to create a platform that would allow an individual to identify a household problem that needs assistance; then head to a local printing store to select a blueprint, from a library of robotic designs; and then customize an easy-to-use robotic device that could solve the problem. Within 24 hours, the robot would be printed, assembled, fully programmed and ready for action. Read more . . . via MIT ᔥ Bookmark this page for "Robotic Design" and check back regularly as these articles update on a very frequent basis. The view is set to "news". Try clicking on "video" and "2" for more articles. > The project could have far reaching implications for a variety of fields. The Massachusetts Institu… [...]
April 5th, 2012 at 9:03 am
[...] The project could have far reaching implications for a variety of fields. The Massachusetts Institute of Technology (MIT) is leading an ambitious new project to reinvent how robots are designed and produced. Funded by a $10 million grant from the National Science Foundation (NSF), the project will aim to develop a desktop technology that would make it possible for the average person to design, customize and print a specialized robot in a matter of hours. “This research envisions a whole new way of thinking about the design and manufacturing of robots, and could have a profound impact on society,” said MIT Professor Daniela Rus, leader of the project and a principal investigator at the MIT Computer Science and Artificial Intelligence Lab (CSAIL). “We believe that it has the potential to transform manufacturing and to democratize access to robots.” “Our goal is to develop technology that enables anyone to manufacture their own customized robot. This is truly a game changer,” said Professor Vijay Kumar, who is leading the team from the University of Pennsylvania. “It could allow for the rapid design and manufacture of customized goods, and change the way we teach science and technology in high schools.” The five-year project, called “An Expedition in Computing for Compiling Printable Programmable Machines,” brings together a team of researchers from MIT, the University of Pennsylvania and Harvard University, and is funded as part of the NSF’s “Expeditions in Computing” program. It currently takes years to produce, program and design a functioning robot, and is an extremely expensive process, involving hardware and software design, machine learning and vision, and advanced programming techniques. The new project would automate the process of producing functional 3-D devices and allow individuals to design and build functional robots from materials as easily accessible as a sheet of paper. “Our vision is to develop an end-to-end process; specifically, a compiler for building physical machines that starts with a high level of specification of function, and delivers a programmable machine for that function using simple printing processes,” said Rus. Researchers hope to create a platform that would allow an individual to identify a household problem that needs assistance; then head to a local printing store to select a blueprint, from a library of robotic designs; and then customize an easy-to-use robotic device that could solve the problem. Within 24 hours, the robot would be printed, assembled, fully programmed and ready for action. Read more . . . via MIT ᔥ Bookmark this page for "Robotic Design" and check back regularly as these articles update on a very frequent basis. The view is set to "news". Try clicking on "video" and "2" for more articles. > The project could have far reaching implications for a variety of fields. The Massachusetts Institu… [...]