Back to description
Announced at the Mix ’07 conference in May of 2007, Silverlight took the world by storm with a vision of Adobe Flash–like... more
Announced at the Mix ’07 conference in May of 2007, Silverlight took the world by storm with a vision of Adobe Flash–like Rich Internet Applications (RIAs) built using a standards-based, open approach with HTML and XAML using tools like Visual Studio .NET and the new Microsoft Expression Blend. The idea for Silverlight is nothing new; Microsoft had been talking about a technology called WPF/e for the previous 8 or 10 months. Interestingly enough, there was so much confusion around what WPF/e meant, the name needed to change to something completely different, a name that did not associate WPF/e with the smart client, next-generation UI platform Windows Presentation Foundation (WPF). The idea was to tack the letter “e” on the end of WPF to convey Windows Presentation Foundation Everywhere. But this was simply not the case. This WPF is a core part of .NET 3.0 and has a 30MB runtime that requires a Windows-based desktop to run. WPF/e was a 2MB download, ran in the browser, and ran on multiple platforms. And multiple platforms here does not mean Windows XP and Windows Vista; it means Windows and Apple Macintosh. It means the Safari web browser on an Apple Macintosh being served up from an Apache web server running on Linux. Yes, you read that correctly, Linux, Mac, Safari, and Windows, too. There are other significant differences as well, which you’ll learn about throughout the next few chapters. Needless to say, the name WPF/e was not going to adequately represent this amazing new technology, so Silverlight was announced as the new name at Mix ’07. This chapter does two basic things:
It gives you an introduction to Silverlight.
It sets the groundwork with the essentials on creating Silverlight applications that will help you move on to the next chapter and the rest of the book.
... less
In Chapter 1, you learned about the basics of Silverlight and how it helps build Rich Internet Applications (RIAs).... more
In Chapter 1, you learned about the basics of Silverlight and how it helps build Rich Internet Applications (RIAs). In this chapter, you dig deeper into XAML and how XAML builds out the user interface that the Silverlight control renders. You learn the following:
How positioning works in Silverlight
The types of objects you can render in Silverlight
How video works in Silverlight
How animation works
We’ve introduced Silverlight and XAML fundamentals in previous chapters, and by now you should be familiar with... more
We’ve introduced Silverlight and XAML fundamentals in previous chapters, and by now you should be familiar with the basic building blocks available for building Silverlight applications. You’ve seen XAML used to define rectangles, shapes, brushes, and even animation and are probably wondering if you’re going to be stuck hand-coding XAML for the rest of your days. Fortunately, the answer is no. Along with the introduction of WPF as a development platform, Microsoft introduced Microsoft Expression Studio, a suite of tools created for designers targeting Microsoft platforms.
Microsoft Expression Blend (Blend) is the tool in this suite used for designing application layouts, creating animation, and adding interactivity to your WPF or Silverlight applications. The initial release of Blend did not include support for Silverlight, because it was still not a public technology. So, in order to author Silverlight applications with Blend, you’ll need to download and install the latest preview release of Blend 2, which adds new Silverlight 1.0 and 1.1 starter templates.
In this chapter, you:
Get an introduction to the Blend interface
See how to create artwork
Create your first timeline
Work with artwork created outside of Blend
It’s time to get started!
So far in this book you have seen how you can create highly interactive and graphically powerful applications using Silverlight,... more
So far in this book you have seen how you can create highly interactive and graphically powerful applications using Silverlight, XAML, and media elements such as video. You have also looked at how you can use tools like Expression Blend to design compelling user experiences for your application. The examples you have seen have involved fairly static HTML and XAML markup that operates in a sandboxed Silverlight player embedded in a web browser. Although this in and of itself is useful, most real-world applications that you build will need to include much more interaction between the end user, the browser, and the Silverlight player. In a realistic Silverlight application you would want to manipulate the XAML elements programmatically, accessing and setting properties at runtime, and even reacting to events that occur in the Silverlight application. Thankfully, Silverlight 1.0 includes a rich programming model that allows you to develop sophisticated applications that seamlessly integrate into the browser and take full advantage of the Internet platform.
In this chapter, we’ll cover:
Creating the Silverlight player using JavaScript
Accessing and manipulating XAML content loaded in the Silverlight player
Creating and using Silverlight player events
Accessing Storyboards programmatically
Using the Silverlight Downloader object
Note
As is the case with all the code samples in the book, the code samples in this chapter are available for download from www.wrox.com.
www.wrox.com
The nice thing for ASP.NET developers is that using Silverlight 1.0 with ASP.NET is a very familiar paradigm.... more
The nice thing for ASP.NET developers is that using Silverlight 1.0 with ASP.NET is a very familiar paradigm. Essentially, the only difference between using Silverlight with ASP.NET and normal ASP.NET development is that instead of using HTML for the presentation, you’re going to use XAML. In some ways, chiefly for rich, animated, cross-browser UIs, this is a great benefit; in others, chiefly in receiving input, due to the limited objects available in Silverlight, it is certainly a restriction.
The key to creating a great Silverlight application in ASP.NET is in recognizing where it is better to use Silverlight (XAML) and where it is better to use ASP.NET (HTML). I’ve already alluded to a key guideline that can help you choose; namely, if you need textual data input, you’re best off sticking with standard ASP.NET and, consequently, HTML input controls. The tricky part comes in choosing when both HTML and XAML would work, and of course, that will vary from project to project, but Table 5-1 contains some suggested guidelines.
As you reviewed the scenarios, you probably started to form a mental map of where Silverlight is strong and where it isn’t. You probably derived that, generally speaking, ASP.NET should still be used as the primary web application development platform and that Silverlight should be used within ASP.NET applications where things like rich media and rich interactivity (such as in navigation) are needed. That’s a good general way to think about using Silverlight with ASP.NET.
You may find that you can bend the rules as your expertise with Silverlight, XAML, and JavaScript increase because with effort you can emulate the areas where basic Silverlight tooling is weak. Whether or not you take that effort will depend on your situation, but it is safe to say that Silverlight 1.0 usage should be limited and targeted in web applications and be thought of as a compliment to ASP.NET, not a replacement. Whether or not this remains true for Silverlight 1.1 and beyond is yet to be seen, but it does have the potential to eventually become the next web platform.
For now, though, we remain grounded in today’s realities, and the rest of this chapter discusses in more depth how you can use Silverlight together with ASP.NET:
First, we look at creating custom ASP.NET controls for Silverlight.
Then we look at how ASP.NET AJAX and Silverlight work together.
Finally, we discuss how you can apply this knowledge to create dynamic user interfaces.
Talk about buzz. Silverlight 1.1 has generated the most buzz of any technology in recent memory, and for good reasonit... more
Talk about buzz. Silverlight 1.1 has generated the most buzz of any technology in recent memory, and for good reasonit has the most promise of any recent technology to make our lives as business application developers easier. Finally we have the potential to create extremely rich user experiences using a reliable, cross-platform technology that has a familiar, well-designed framework, great tooling, and an awesome developer community. It’s everything we’ve ever wanted!
Well, almost. Silverlight 1.1 certainly has a ton of promise, but some key elements are missing in the 1.1 iteration:
Text SupportBoth in terms of display and input, Silverlight is lacking severely in text support. Before it can become the next great technology, it needs to acquire, at a minimum, basic textual input features, and to make it really shine, it needs to develop document and markup features as compelling (or more so) than HTML and CSS. WPF is a good paradigm for this.
Control ModelTo empower control developers, particularly third parties, Silverlight needs to develop a robust control model.
Layout OptionsRight now, all we have is Canvas. We need more, familiar layout options such as flow/wrap, grid/table, and so on to make regular application development feasible.
Canvas
Data Binding/TemplatingAll business applications deal with data, and to make regular application development reasonable, we need a good template-based data binding mechanism. Again, WPF has the best implementation of this.
StylingCSS has shown the value of separating appearance from function, and WPF took it a step further to make controls “lookless,” enabling complete redesign of a control’s appearance. Also, the ability to reuse styling across controls and even applications is critical for maintainable applications and consistency.
LocalizationIn this increasingly globalized world, a new web-based technology must have a strong internationalization story, and it needs to be easy to use in the UI layer.
The good news is that Microsoft is aware of all of this and is actively researching how best to build out Silverlight while making it feasible to run cross-platform and minimize download size and client requirements. It’s a tough task, but developers will surely have a gem when all’s said and done.
Now that we’ve added a breeze of reality and a dash of hope, we can talk about what we do know about Silverlight 1.1 today. As of this writing, we’re in the 1.1 Alpha Refresh release, which is essentially (feature-wise) the same as the original alpha. The nice thing is that the feature set is pretty much on par with 1.0, so everything you learned about 1.0 is applicable. The primary difference is, of course, that 1.1 gives us the CLR on the client, whereas with 1.0, we’re stuck with JavaScript in terms of automation.
We say that 1.0 and 1.1 are basically the same, as if having a CLR and parts of the .NET Framework is something to sneeze at. Of course, it is one of the more revolutionary advancements in distributed application development, not because the capabilities in themselves are revolutionary (after all, at the most basic level, it is essentially like a Java applet), but because it is as if we are finally going to be able to work with both armsnot having one tied behind our backs while trying to create rich, maintainable, cross-platform applications that are relatively easy to build, something we just don’t have when depending on the mishmash of technologies (HTML, CSS, JavaScript, and so on) and varying interpretations of those by browsers.
To illustrate the difference between 1.0 (unmanaged, you could say) and 1.1 (managed) Silverlight, consider Figures 6-1 and 6-2. These illustrate the relationship between Silverlight and the related technologies. In the unmanaged/1.0 Silverlight illustration (Figure 6-1), you see that essentially we’re just introducing a scriptable objecteverything else about building a Rich Internet Application (RIA) today remains true. In the managed/1.1 (Figure 6-2), you see the introduction of the CLR and managed libraries that we’ll delve into in this chapter.
The purpose of this chapter is to introduce Silverlight 1.1 from a high level. We won’t be delving into specifics or providing code examples here because 1.1 is still in Alpha and, as noted, has a lot to add and probably change. But there is still a fair bit to say about it because the target scenarios of rich Internet/distributed applications are pretty well known, and it is those that are driving the development of 1.1. Therefore, we already have a pretty good idea of the core functionality based on what’s in the Alpha. Though the specific APIs can and will certainly change as managed Silverlight develops, the core functionality needed to support the target scenarios will not. So reading this chapter will give you a pretty good idea of the current capabilities and some idea of the APIs, giving you the foundation to explore further as the technology develops.
You should also check out our additional online chapter for this book that is devoted to 1.1 and has sample code that we intend to keep up to date as 1.1 develops. The online chapter is available along with the code download at www.wrox.com.
One of the challenges of learning a new technology is that often you never get the opportunity to see the topics covered... more
One of the challenges of learning a new technology is that often you never get the opportunity to see the topics covered by a book applied in an actual application. To help see how you can use Silverlight to create a realistic, real-world application, we are including a case study on a Silverlight-based application called Lumos. Lumos is a video player that demonstrates how you can create rich, interactive Silverlight-based applications using Blend, ASP.NET AJAX, JavaScript, and XAML. You can view the Lumos application online by visiting http://labs.infragistics.com/wrox/silverlight1_0/chapter7.
http://labs.infragistics.com/wrox/silverlight1_0/chapter7
Also note that the source code for the Lumos application is included along with the other code from the book and is available for download from www.wrox.com. However, to keep the file size of the download manageable, the code for the Lumos application available for download includes only a couple of the video clips from the full application.
www.wrox.com.
Specifically, this chapter focuses on:
Setting up the architecture and interface for the Lumos application
Preparing the media for the application
Coding the application
By the end of the chapter you’ll have a good understanding of how to create your own Silverlight-based applications.
This appendix is designed to be a quick reference on the objects (classes) that can be instantiated via XAML or JavaScript... more
This appendix is designed to be a quick reference on the objects (classes) that can be instantiated via XAML or JavaScript to render the user interface you are creating in Silverlight. It lists in alphabetical order the non-abstract classes that deal with layout, shapes, geometries, animations, transformations, and text.
If you have already read the entire book, you have a pretty good idea of what XAML is and how it works.... more
If you have already read the entire book, you have a pretty good idea of what XAML is and how it works. This appendix serves as a reference point for some of the details of XAML that may not have been covered in the book. Though this appendix is not a complete reference on XAML, it gives you the pertinent details that will answer the questions you have to be successful with Silverlight.
For a complete reference on XAML, you should visit the XAML reference on MSDN at http://msdn2.microsoft.com/en-us/library/ms747122.aspx, which includes XAML characteristics for WPF as well.
http://msdn2.microsoft.com/en-us/library/ms747122.aspx
Purchase Before purchasing this product, please be sure you have met all software and system requirements, and that you understand any limits placed upon its use.
Return Policy Wrox Chapters on Demand are non-returnable and non-refundable.
Reader Software Wrox Chapters on Demand are offered as PDFs, and they must be viewed using the Adobe Reader. If you do not have the Reader installed, it can be downloaded for free at Adobe.com.
Test Download As Wrox Chapters on Demand purchases are non-returnable, it is advisable that you test your system and software configurations with a free sample download before you place an order.
Usage Rights for a Wrox Chapter on Demand File Any Wrox Chapter on Demand product you purchase from this site will come with certain restrictions that allow Wiley to protect the copyrights of its products. After you purchase and download this title, you:
If you have any questions about these restrictions, you may contact Customer Care at (877) 762-2974 (8 a.m. - 5 p.m. EST, Monday - Friday). If you have any issues related to Technical Support, please contact us at 800-762-2974 (United States only) or 317-572-3994 (International) 8 a.m. - 8 p.m. EST, Monday - Friday).
Related Books
ASP.NET Resources