Skip to Content
Introducing Silverlight 1.1
book

Introducing Silverlight 1.1

by Todd Anglin
October 2007
Intermediate to advanced
76 pages
2h 6m
English
O'Reilly Media, Inc.
Content preview from Introducing Silverlight 1.1

Building Applications with Silverlight 1.1

Now it is time to pull all of the concepts, code samples, and Silverlight 1.1 ideas together to build a sample Silverlight application. In this section, two sample Silverlight controls will be built that can be used in any Silverlight 1.1 application: a custom button control and an upload control. These controls will illustrate the concepts covered in this Short Cut and provide more insight into the Silverlight application development process.

Custom Silverlight 1.1 Button Control

Creating a custom Silverlight control involves two basic tasks—defining the visual appearance of the control and providing it with functionality. The UI is primarily defined in XAML markup and the object model is primarily defined in code. Each custom control is described by its API (Application Programming Interface), which exposes public properties, data fields, and events.

The general structure of a custom Silverlight control is a XAML file and a code behind file contained in a Silverlight User Control project.

Every custom Silverlight control must inherit from the .NET Control class, illustrated in Figure 25.

Class hierarchy of .NET Control class

Figure 25. Class hierarchy of .NET Control class

Our XAML file will contain one Rectangle that will determine the boundaries of the control and one TextBlock that will serve as a text holder. The XAML markup for the control can be seen in Example 6.

Example 6. Button ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Silverlight 1.0 Unleashed

Silverlight 1.0 Unleashed

Adam Nathan

Publisher Resources

ISBN: 9780596515836Errata