Conclusion Wyp
Silverlight applications execute in a remote environment on the client's workstation that is isolated from the client's file system by the security sandbox. Silverlight includes the ability to work with data coming from server-side databases as well as data stored in XML. Silverlight includes classes located in the System.Xml namespace for working with XML data. Silverlight also includes classes located in the System.IsolatedStorage namespace that enable storing minimal data locally on the...
JavaScript Object Notation JSON
JavaScript Object Notation JSON is a very succinct and to-the-point communication protocol and is very simple to read. JSON, as its name implies, is used most commonly by applications that utilize JavaScript. However, JSON can be used by any application type or programming language that supports it. The following code snippets illustrate various JSON data configurations single name value pair. multiple name value pairs. more elaborate data construct similar to an array or object.
Transformations
Transformation objects are used to transform other Shape objects. There are various types of transformations, including rotations, scales, skews, and translations. A scale is a resize. A skew transformation skews the shape of the Shape object. A translation moves a shape. The following markup snippet illustrates applying a 45-degree rotation to a TextBlock lt ScaleTransform ScaleX 1 ScaleY 1 gt lt SkewTransform AngleX 0 AngleY 0 gt lt RotateTransform Angle 45 gt lt TranslateTransform X 0 Y 0 gt...
Try This Create a LINQ Query
1. Start or open Visual Studio 2010. 2. Select File New Project to create a new Silverlight project. 3. When prompted with the New Project dialog, under the programming language of your choice listed in the pane on the left side of the dialog, select the Silverlight node. 4. In the Templates pane on the right side of the dialog, select the Silverlight Application template. 5. Assign the new project a name, select a location to create the project, and then click OK. 6. When prompted with the Add...
Eclipse
Eclipse is a popular development editor for Windows and Macintosh. Eclipse is the first code editor developed by a vendor other than Microsoft that can be used to create Silverlight applications. Eclipse Tools for Silverlight can be found online at http www .eclipse4sl.org. The Eclipse New Project dialog showing the option to create a new Silverlight project on the Macintosh is shown in Figure 3-13. Figure 3-13 The Eclipse New Project dialog for a new Silverlight project
Silverlight Security Functionality
It should be reiterated that Silverlight applications execute on the client's machine and communications with a server occur only when initiated manually from the Silverlight application. Calls to a server from a Silverlight application are made asynchronously to a Web Service. Microsoft may include controls and functionality to assist in performing related security tasks however, at this time, security features and functionality included in Silverlight are minimal. The minimal security...
Serialization
The Web is a stateless environment. In a typical web communication scenario, a request for a resource is made by a client passing a message to the web server. The web server, in turn, replies to the client by sending a response message. Messages continue to be sent back and forth between the client and server to conduct the communications necessary to deliver an application. The messages that are sent between the client and the server contain simple text. If the messages used to conduct...
Work with the Expression Blend Visual State Manager VSM
Although it is vitally important to understand how to network using Silverlight, the primary focus of Silverlight is to create RIAs where a user can be presented with an elaborate UI. As such, it is imperative that a developer or a designer understands the tools available for creating user interfaces using Silverlight. Silverlight version 1 did not include user interface controls however, when Microsoft released Silverlight 2, they included a gamut of user interface controls as well as the...
Figure An Expander control that contains a TextBlock
Header My Stuff ToolTipService.ToolTip this is my stuff that i only display when i choose to IsExpanded False UseLayoutRounding True gt lt TextBlock Text this is my stuff my very important stuff TextWrapping Wrap Margin 8,8,6,12 lt controls Expander gt Figure 8-13 shows an Expander control that is expanded. The Expander control contains a TextBlock control.
RadioButton Control
A RadioButton control is included in a group with other RadioButton controls. Each RadioButton control is used to make a selection out of a group of options. A single RadioButton control should not be displayed to a user because once a single RadioButton is selected, it cannot be deselected. RadioButton controls are intended to allow the user to make a mutually exclusive selection out of a group of possible selections. RadioButton controls should be displayed as a group to the user.
Conclusion Bia
The .NET Framework is the leading development environment in the industry. A key selling point for teams adopting Silverlight as a development platform is that the armies of existing .NET developers can almost immediately leverage their existing knowledge to create Silverlight applications. Silverlight development teams may have the final user interface for an application designed prior to developing the actual user interface. However, by using control templates, a developer can quickly build...
Label Control
A Label control is simply a text string displayed in an application. A Label control differs from a TextBlock control in its intended use. Most user interface controls have a descriptive label next to and associated with them that identifies the intended purpose of the control. Prior to Silverlight 3, user interface control labels were created using a TextBlock control. Silverlight 3 introduces the Label control designed for this use. The Label control is a simple control but includes some...
Figure DataForm control user interface designed using Expression Blend
4. Use Expression Blend to drop a DataForm control onto the Silverlight design surface. Also, add a Button control and a TextBlock control so that the DataForm control resembles Figure 12-1. 5. Back in Visual Studio 2010, right-click the Silverlight project and add a new class. Design the class as you see fit. The sample class shown here stores simple personal information for an athlete public string FirstName get set public string LastName get,-set public bool Athlete get set public string...
Creating a Simple Silverlight Animation
Creating animations for Silverlight can be a simple process, depending on the animation you have in mind. Silverlight animations can be created using Visual Studio 2010 either programmatically or through XAML. However, the tool of choice for creating animation is Expression Blend. A standard, simple animation to get started with in Silverlight consists of a spinning circle reminiscent of the one displayed in Windows Vista when waiting on a lengthy process to complete .
Figure The Expression Blend gradient palette
20. Press F5 to test the application in the default browser. You should see the wet floor effect in action. Close the browser to return to Blend. 21. Save the project and exit Blend. The XAML shown next is used to generate the wet floor effect using the same video file illustrated previously lt UserControl x Class L05 02.Page 00 6 xaml presentation 00 6 xaml Width 594 Height 4 24 gt lt UserControl.Background gt lt LinearGradientBrush EndPoint 0.5,1 StartPoint 0.5,0 gt lt GradientStop Color...
Ask the Expert Bjt
Q The Path markup language is complex and confusing. How can I easily create a path A The easiest way to create paths and geometries in Silverlight is to use Expression Blend. Blend includes tools such as the pencil tool that you can use to easily create paths. Using the pencil tool, you can create whatever shape or drawing you desire and Blend will render the correct Path markup language. Furthermore, if you need to create more advanced graphics for your application and would like them...
Designing User Interfaces
With Silverlight still in its infancy, formal user interface design standards have not yet been compiled. However, many standards are being implemented in the industry by those who are creating applications using Silverlight. In a nutshell, the design standards recommended by Microsoft follow the User Experience UX guidelines for Windows Vista. The UX guidelines are documented in the MSDN document titled Guidelines, located at
Microsoft Active Server Pages ASP
Microsoft's web development platform, prior to the release of the .NET Framework, was named Active Server Pages ASP . ASP was extremely popular but could not really be extended any further than it had been extended in the late 1990s without being completely redesigned. ASP rendered web content dynamically by intermingling web markup with script code, executing the script code on the server, and generating and sending the result to the client's browser. ASP was designed in the infancy of the Web...
Designing the Silverlight XAML
The initial sample application created in this section is a simple echo program that follows suit with most programming texts. The steps to create the simple Silverlight application 1. With the MainPage.xaml open in Expression Blend, from the Objects and Timeline panel of the Interaction tab, select the LayoutRoot node. 2. Use the Brushes panel of the Properties tab to configure the background of the root Grid control to your liking. For example, you may change the background fill to a gradient...
Additional Performance Tips
In addition to the techniques illustrated above, the following tips are recommended by Microsoft to further improve performance of Silverlight applications. Test on multiple platforms and browsers. Set EnableFrameRateCounter to True during development. Use the transparent background for a Silverlight plug-in sparingly. When animating the opacity or transform of a UIElement, set its CacheMode. While animating text, set TextRenderingMode to RenderForAnimation. Avoid using Windowless mode. Use...
RepeatButton Control
A RepeatButton control is used to repeat the action associated with a Click event while the button is held down. The RepeatButton includes properties to control the speed and interval the button uses to determine how fast to repeat the Click action. The Delay property indicates in milliseconds how long the button control should delay after the user clicks the button before it should begin repeating the Click action. The Interval property indicates how many milliseconds should pass between...
DatePicker Control
The DatePicker control is used to display a Calendar control to the user for the selection of a date value. The calendar displayed by the DatePicker is shown only when the user clicks the DatePicker control. Once the user makes a selection from the displayed Calendar control, the selected value is returned and the calendar is hidden. The DatePicker is intended to be used for a single date value selection, so as to not consume the user interface real estate necessary to display a full Calendar...
Explore the Expression Encoder
In addition to displaying incredible graphics and animation, Silverlight is able to display on-demand and live streaming audio and video media, giving the user complete playback control. Although a media stream does not have to be specifically prepared for playback using Silverlight, Silverlight only supports the display of certain media formats. Also, when media is prepared for display using Silverlight, the media is able to take advantage of Silverlight-specific functionality and features.
Observe how to create an RSS feed reader using Silverlight
Developing applications in a Silverlight world may present a mental obstacle to veteran ASP.NET developers. Developers who have web development experience will have the concept of continual postbacks deeply engrained into their minds. A Silverlight application executes within a plug-in environment, and as such there are no automatic postbacks to the server where the Silverlight application originated. If a call to a server is necessary from a Silverlight application, the call must be manually...
Silverlight Project Architecture
When you create a new Silverlight project using Visual Studio and select the option Host the Silverlight application in a new Web site, two projects are created. One project contains the actual Silverlight application, and the second project serves as a test harness for the Silverlight application. When you create a Silverlight project using Expression Blend, a test harness project is automatically created but it's not nearly as robust as the Web application test harness project created by...
Expander Control
The Expander control is typically used for user interface organization and navigation purposes. The Expander control displays a header with a caption that describes its contents. The Expander control also displays a button in the header that expands and collapses the contained region. The Expander control is useful for integrating controls and sections into a user interface that may not be used as often. The following markup illustrates an Expander control 00 6 xaml presentation 00 6 xaml 0 08...
This Use the MultiscaleImage Control in Deep Zoom Composer
1. Navigate to to download the Deep Zoom Composer. 2. At the Deep Zoom Composer download page, click the Download button. 3. When prompted with the File Download dialog, click the Run button to install the Deep Zoom Composer. 4. Click the Next button all the way through the Deep Zoom installer to accept all the default settings. 5. Once Deep Zoom Composer is installed, start or open it. 6. When prompted by the Deep Zoom Composer startup screen, select the link to create a new project. 7. When...
rhis Create a Wet Floor Effect
A popular visual effect when playing video using Silverlight or WPF is the wet floor effect. This effect can easily be accomplished by using Expression Blend. It consists of displaying a video twice once for display and once for reflection. This effect can be easily accomplished by using two MediaElement elements. However, taking this approach will load the media file into memory twice, and the two copies playing may become out of sync with each other. The preferred approach is to display the...
Microsoft Expression Encoder
Audio and video and the combination of the two are generically referred to as media. Media may exist in various formats. Most media vendors, such as Microsoft, Apple, and Real, distribute and save media in proprietary formats. Most media players will play media in multiple formats. There are also industry-standard media formats that most players also support. Media may be stored in a particular format when it is saved after being recorded or may be converted from one format to another using a...
XAML Tools
The primary tools for creating and manipulating XAML documents are those tools available from Microsoft however, several third-party XAML tools are on the horizon, including KaXAML. Microsoft Visual Studio 2010 is Microsoft's premiere development tool. All development tools from Microsoft have now been assimilated into Visual Studio. Figure 2-2 shows the Visual Studio 2010 start page. Microsoft has developed and released an entire suite of tools, called the Microsoft Expression Suite, that is...
HyperlinkButton Control
A HyperlinkButton control is displayed like a standard HTML hyperlink but has an associated Click event so that it behaves like a standard Button control. The hyperlink button also behaves like a standard HTML hyperlink if its NavigateUri property is set to a valid URL, as shown in the following markup lt UserControl x Class L0815.Page 00 6 xaml presentation 00 6 xaml 0 08 compatibility 2 00 6 mc Ignorable d
Isolated Storage
Due to the security constraints placed on a Silverlight application the sandbox that it operates in , a Silverlight application, on its own accord, cannot write directly to or read directly from the file system on the client's machine. In an effort to allow developers to store some data local to the client, Microsoft designed Silverlight to read data from and write data to a virtual file system called Isolated Storage. Isolated Storage is instantiated by using cookies. You need to be aware of a...
The WebClient Class
Silverlight includes a class called the WebClient class that is used to directly download resources from a web server. The WebClient class was formerly called the HTTP Downloader. The WebClient class is best suited to directly downloading larger resources from a web server that may take time to download, including images and media files. All networking calls made in Silverlight are asynchronous calls hence, all calls made by the WebClient class are asynchronous. A few steps are involved in...
Variables
The most basic means of storing data in memory is through the use of variables. All programming languages support some form of variables. A variable is a named location in memory used to store data. Most programming languages share a common means of storing data as variables however, the specifics of how data is stored and managed in memory is particular to a programming language. Strongly typed programming languages are very strict about what type of data can be stored in a variable. Weakly...
Chapter Nxz
Compare synchronous to asynchronous programming techniques Learn how to use the WebClient class to download resources from a web server Applications typically display files to a user that are large in size, such as images and media files. If a single image, such as a company logo, is to be displayed to a user, it may be best to embed that image in the Silverlight application so that it is available on the client machine without any additional effort. However, what if many images or media files...
Image Control
An Image control is used to display an image. Silverlight supports the display of popular web image formats, including JPG and PNG. However, due to legalities, it does not support the display of GIF files. The following markup illustrates the use of an Image control lt UserControl x Class L0816.Page 00 6 xaml presentation 00 6 xaml 0 08 compatibility 2 00 6 mc Ignorable d d DesignHeight 3 00 d DesignWidth 4 00 gt lt Grid x Name LayoutRoot Background White gt lt Image Height 200 Source...
XAML Element Data Binding
Silverlight 3 simplifies data binding somewhat by allowing target controls to be bound directly to the value of a property of another user interface control using XAML. In Silverlight 2, target controls could be partially bound to the value of a property of another control using XAML. However, in order for a control to be fully data bound to the value of a property of another control, the name of the control and the name of the property must be configured using XAML. Silverlight 2 only...
rhis Create a Control Skin
To skin a Silverlight control, follow these steps 1. Start or open Expression Blend. 2. When prompted, create a new Silverlight project. Assign the project a name, select a location to create the new project, and then click OK. 3. From the toolbox on the left side of Blend, drag a control such as a TextBox and drop it onto the Silverlight design area. 4. To create a template or skin for the control, right-click the control and select Edit Control Parts Template Edit a Copy from the context...
Working with Data Stored in XML
The Extensible Markup Language XML was released by the World Wide Web Consortium W3C http www.w3.org in 1999 as a standardized means of storing and transporting data over the Web. XML has proliferated web development technologies, and virtually all software development platforms support some form of XML interaction. The .NET Framework contains a gamut of classes for working with XML data in the System. Xml namespace. Silverlight contains a subset of XML functionality in the System.Xml...
Slider Control
A Slider control is used to slide across a range of values. The minimum and maximum values to slide across as well as the increment to be used when sliding across the span of values are configured using the control properties. The Slider control includes an event named ValueChanged that can be used to take an action in response to the user adjusting the Slider control. The following markup illustrates a Slider control lt UserControl x Class L08 23.Page 00 6 xaml presentation 00 6 xaml 0 08...
Illustrate how to use the classes in the Silverlight SystemSecurity namespace
Traditionally, web applications have been considered difficult to secure. Silverlight applications are rich interactive applications RIAs , an application type that runs locally on a client machine but utilizes the Web as a transport and communication mechanism. Hence, Silverlight applications are faced with all the security challenges of a standard web application. However, whereas most commonly used web development frameworks, such as ASP.NET, include intrinsic server-side security features,...
Language Integrated Query LINQ 1
A major addition to the .NET Framework in version 3.5 was Language Integrated Query LINQ . Most seasoned developers have mastered or are adequately familiar with the Structured Query Language SQL . SQL is used to query relational database data. However, in many cases, SQL queries that pull data from a relational database schema are abstracted away from business logic and middle-tier code. Data may also be stored in formats other than a relational database such as an XML file or a consumed Web...
Managing User Authentication Information
All sensitive data must be handled with extreme care in order to keep it secure. User credentials are of particular importance. If valid user credentials are compromised, a malicious user can gain access to deeper levels of sensitive data managed by the application. Credentials typically take the form of a username and password and must be gathered from a user through a page or screen. Once acquired, the credentials must be passed to a method in a Web Service that can use the credentials to...
Animation Easing
Although the primary types of animations are from-to-by and keyframe, it is difficult to simulate true extended animation and natural movement using these animation types. To reiterate, from-to-by animations are used to animate a single property of a single object, whereas keyframe animations are used to animate multiple properties of multiple objects simultaneously. However, even the simplest animation is difficult to simulate. Silverlight 3 introduces animation-easing effects that are used to...
Windows CardSpace
Windows CardSpace is Microsoft's new digital identity management system. CardSpace is client-side software that is included with .NET Framework 3.0. CardSpace stores a user's digital identities and presents them to users in the form of visual cards, as shown in Figure 2-8. Figure 2-8 Windows CardSpace manager CardSpace is used to identify users over the Web. Users can create their own identities and verify those identities through third-party vendors. When a website needs to authenticate a...
Figure The Silverlight RSS feed reader display
Silverlight 3 ships with a class designed for working with syndication feeds the class. However, prior to you working with a feed using the SyndicationFeed class, the feed contents must first be requested, read into memory, and parsed into the correct format. Furthermore, when a syndication feed is requested, a cross-domain call is being made, so the server where the feed resides must have a CrossDomain.xml file in place to allow a cross-domain request. The upcoming code listing illustrates...
ToggleButton Control
A ToggleButton control functions like a CheckBox control in that it is used to make a yes or no selection. However, a ToggleButton control looks like a standard Button that remains depressed once a user clicks it until the user clicks it again. As with a CheckBox control, a ToggleButton control supports the IsThreeState property. The following markup listing illustrates the use of a ToggleButton control lt UserControl x Class L08 24.Page 00 6 xaml presentation 00 6 xaml 0 08 File Edit View...
The Silverlight Project
The first step in creating a Silverlight application is to create a new Silverlight project. Figure 3-16 shows the new Silverlight project dialog displayed when using Visual Studio 2010, and Figure 3-17 shows the new Silverlight project dialog displayed when using Expression Blend. Figure 3-16 The Visual Studio 2010 New Project dialog for a new Silverlight project Figure 3-16 The Visual Studio 2010 New Project dialog for a new Silverlight project Silverlight 3 Application Website 5 WPF...
Create a Simple Animation
Using Expression Blend, Silverlight animations can be easily created using steps similar to those listed below. 1. Start or open Visual Studio 2010. Select File New Project to display the New Project dialog. 2. Under the .NET Framework programming language of choice, select the Silverlight node in the Project Types pane on the left side of the New Project dialog. 3. Select Silverlight Application in the Templates pane on the right side of the New Project dialog. 4. Assign the new project a...
Ujt Applications
Gain an understanding of how to work with data programmatically Observe how to use Silverlight to access data stored as XML Learn how to use Language Integrated Query LINQ in Silverlight applications Explore the use of Silverlight Isolated Storage for storing data locally on the client machine Data is imperative to business applications. Silverlight is commonly compared to other popular RIA technologies. However, due to the armies of existing .NET developers who will be developing applications...




















