Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows Phone 7 Silverlight Cookbook

You're reading from   Windows Phone 7 Silverlight Cookbook All the recipes you need to start creating apps and making money.

Arrow left icon
Product type Paperback
Published in Aug 2011
Publisher Packt
ISBN-13 9781849691161
Length 304 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Jonathan Marbutt Jonathan Marbutt
Author Profile Icon Jonathan Marbutt
Jonathan Marbutt
Robb Schiefer Robb Schiefer
Author Profile Icon Robb Schiefer
Robb Schiefer
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Custom behavior


One of the limitations with behaviors is that most of the time they are not really complex, which is great but sometimes you need to create a very reusable set of functionality that is an action. We can do this by creating a custom behavior. In our case, this example will be just to show a popup with a string that is passed in.

Getting ready

To get started, add an item to the project we've been working on and name it ShowPopupBehavior, as shown in the following screenshot:

How to do it...

As we have seen in the previous examples it is easy to implement the built in behaviors, but what if you want more functionality, this is how we do it.

  1. 1. From the Projects tab, we will want to open the file in Visual Studio by right-clicking the file and selecting Edit in Visual Studio.

    Luckily when creating a behavior in Blend like this, before going into Visual Studio, it creates a nice template for you to go by as follows:

    using System;
    using System.Collections.Generic;
    using System.Text;...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image