O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The “this” Source

Perhaps you have an application where you need to display many short text strings with borders around them. You decide you want to derive from UserControl to create a control named BorderedText that you can use like so:

<petzold:BorderedText Text="Ta Da!"
                      FontFamily="Times New Roman"
                      FontSize="96"
                      FontStyle="Italic"
                      FontWeight="Bold"
                      TextDecorations="Underline"
                      Foreground="Red"
                      Background="Lime"
                      BorderBrush="Blue"
                      BorderThickness="8"
                      CornerRadius="36"
                      Padding="16 4"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center" />

As you can see from the XML namespace prefix, this class is already in the Petzold.Phone.Silverlight library.

BorderedText derives from UserControl, and UserControl derives from Control, so we know that BorderedText ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required