basic questions on silver light technology - code project

Upload: kukawalkar

Post on 07-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    1/16

    Web Development Silverlight GeneralLicence CPOLFirst Posted 12 Jun 2010Views 33,859

    Downloads 0Bookmarked 73 times

    Basic Questions on SilverlightTechnologyBy keesari_anjaiah | 12 Jun 2010

    C # .NET Dev XAML Beginner Silverlight RIA

    In this article, you will learn the basics of the Silverlight technology.

    4.86 (35 votes)

    Table of Contents

    1. What is Microsoft Silverlight?

    2. Why use Silverlight?3. Which platforms does Silverlight support?4. Which browsers does Silverlight support?5. What are the system requirements for Silverlight?6. What is Moonlight?7. What are the goals of Moonlight?8. Is Silverlight free?9. What is the difference between Silverlight 1.0 and 2?

    10. What is the Silverlight plug-in?11. What is Silverlight Runtime?12. What is Silverlight SDK?13. What are the tools required to develop Silverlight applications?14. Which tool to use - Expression Studio or Visual Studio?15. What are the Silverlight versions available so far?16. What is a .xap file?17. How does XAP work?18. How do I use a .xap file?19. Can we add a reference to a Class Library project in a Silverlight application project?20. What is a Silverlight.js file?21. What is the use of the ClientBin folder?22. How to change the default page of a Silverlight application?23. What is XAML?24. What is the AppManifest.xml file?25. What files are contained within a .xap file?26. What is app.xaml?27. What is the Silverlight official name?28. What are the main features and benefits of Silverlight?29. What is MainPage.xaml?30. Which language is Silverlight developed in?31. Can I consume WCF and ASP.NET Web Services in Silverlight?32. What are Deep Zoom and Deep Zoom Composer?33. What is the difference between WPF and Silverlight?34. What is the difference between Silverlight and Flash?35. What is the difference between Silverlight and ASP.NET AJAX?36. What are the different Layout controls available in Silverlight applications?37. Are XAML files compiled or built at runtime?

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    2/16

    38. What is the long-t erm goal or vision for Silverlight?39. Do I need to have the .NET Framework installed in order to use Silverlight?40. What are the other RIA technologies besides Silverlight?41. What is meant by RIA?42. What is .NET RIA Services?43. What are the design files and the code-behind files in Silverlight?44. Who is using Silverlight?45. What features are missing from Silverlight presentation markup that will be supported in WPF?46. Will I need more memory, a faster processor, or a better Graphics Processing Unit (GPU)?

    47. How does Silverlight make the Microsoft development system better?48. What is the relationship and difference between Silverlight and ASP.NET?49. When to use Silverlight, ASP.NET, or both?50. What are the new features of Silverlight 4?

    Overview

    These days, Ive been digging into Silverlight and going through a couple of websites and finding somematerials, and I thought of sharing the same with you. There is nothing great I have done in this articleexcept spend a couple of hours and compiled all the questions in one place.

    In this article, you will learn the basics of the Silverlight technology.

    Who should read this article?

    This article is intended for everyone who wants to improve their skill set with Silverlight technology.

    This article will be helpful if you are preparing for a Microsoft interview.This article will be helpful if you are new to Silverlight and want to know more about it.This article will be helpful if you are already familiar with Silverlight but looking for brush upknowledge.This article will be helpful if you are looking for a quick tutorial on Silverlight technology.This article will be helpful if you are looking for Frequently Asked Questions (FAQs) on Silverlighttechnology.

    You can ready my other articles on Silverlight here:

    An Introduct ion to SilverlightGetting Started with Silverlight Application DevelopmentDatabinding in Silverlight applicationsAnimation in Silverlight

    1. What is Microsoft Silverlight?

    Silverlight is a web based technology, launched by Microsoft in April 2007. Silverlight isconsidered as a competitor to Adobe's Flash.Silverlight is Microsoft's implementation of a cross-browser, cross-platform client framework that

    allows designers and developers to deliver Rich Internet Applications (RIA) embedded in Webpages.Silverlight is a browser plug-in approximately 6MB in size; it is client-side free software, with aneasy and fast (less than 10 sec) one time installation available for any client side browser.It supports advanced dat a integration, multithreading, HD video using IIS Smooth Streaming, andbuilt-in content protection. Silverlight enables online and offline applications for a broad range of business and consumer scenarios.One of the design goals of the Silverlight technology is to fill the gap between Windowsapplications and Web applications in terms of creating Graphical User Interfaces (GUI).Silverlight applications are run as client-side applications without the need to refresh the browserto update the UI. However, because of the built-in .NET framework, Silverlight applications caneasily integrate with server-side controls and services. Using Silverlight's implementation of the

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    3/16

    .NET framework, developers c an easily integrate exist ing libraries and code into Silverlightapplications.

    2. Why use Silverlight?

    Support for the .NET Framework if you are already a .NET developer, it is easy to startprogramming on Silverlight.Support for managed code you can write programs in your favorite language which .NET CLRsupports like C#, VB.NET, dynamic languages (IronPython, IronRuby).

    Better development tools -Visual Studio 2010, Expression Blend.Large community- More learning resources available compared to Flash.Integration with Enterprise based technologies like WPF, LINQ etcSilverlight integrates the XAML declarative language with the .NET framework.It is a cross-browser, cross-platform technology which provides a consistent user experienceeverywhere it runs.The Silverlight plug-in installs in seconds, and leaves a very small footprint.After you install the plug-in, users no longer need to install anything on their workstations to runSilverlight applications. The applications are available to them from whatever browser they areaccessing.It runs a client-side application that can read data and update the UI without interrupting theuser by refreshing the whole page.

    It can run asynchronous communications with the server, allowing the UI to continue to functionwhile waiting for the server response.It delivers rich video, audio, and graphics.

    3. Which platforms does Silverlight support?

    Mac OSWindows VistaWindows XP SP2Windows 2000Windows Server 2003Linux (Moonlight)

    4. Which browsers does Silverlight support?

    Microsoft - Internet Explorer 6, 7, 8Mozilla - Firefox 2 and 3Apple - Safari 3 and 4Google - Chrome

    5. What are the system requirements for Silverlight?

    The system requirements for Microsoft Silverlight and associated technologies are listed below.

    Windows

    Operating System: Windows 7, Windows Vista, Windows XP Service Pack 2Intel Pentium III 450MHz or fast er processor (or equivalent)128MB of RAM

    Mac OS

    Operating System: Apple Mac OS X 10.4.8 or aboveIntel Core Duo 1.83GHz or faster processor128MB of RAM

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    4/16

    Linux

    Moonlight

    6. What is Moonlight?

    Moonlight is an Open Source implementation of Silverlight, primarily for Linux and other Unix/X11 basedOperating Systems. In September of 2007, Microsoft and Novell announced a technical collaborationthat inc ludes access to Microsoft's test suites for Silverlight and the distribution of a Media Pack forLinux users that will contain licensed media codecs for video and audio.

    Moonlight 2 was released December 17, 2009

    7. What are the goals of Moonlight?

    To run Silverlight applications on Linux.To provide a Linux SDK to build Silverlight applications.To reuse the Silverlight engine built for desktop applications.

    8. Is Silverlight free?

    Yes, Microsoft has made the Silverlight browser plug-in freely available for all supported platforms andbrowsers.

    9. What is the difference between Silverlight 1.0 and 2?

    Silverlight 1 is purely AJAX and JavaScript based. All the code has to be written in JavaScript andXAML.Silverlight 2 supports managed c ode. When the Silverlight 2 runtime is installed, it installs alimited version of the .NET runtime on the client machine. This allows .NET programmers to writemanaged code to be executed on the client PC, and provides a better user experience to users.Of course, there is security restrictions built in to it so that the code has limited access to theclient computer.

    The biggest change is the implementation of the .NET Framework. If you are familiar withSilverlight 1.0, then you will be used to coding the application functionality in JavaScript. Youcan still implement functionality using JavaScript; however, you can now also implementfunctionality using C#, Visual Basic, Python, Ruby, and managed JavaScript.Another major change is the introduction of the XAP package. In Silverlight 1.0, the XAML codewas referenced directly by the Silverlight object embedded in the browser. In Silverlight 2,however, t he embedded object references an XAP package that contains the XAP file,assemblies, and resources necessary to run the Silverlight application.

    10. What is the Silverlight plug-in?

    The Silverlight plug-in is a very lightweight component that is necessary for users to accessSilverlight applications. The plug-in download and install takes only a few moments, and do nottake up much hard drive space.The Silverlight plug-in is responsible for accessing the Silverlight object in the Web page,downloading and accessing the XAP package, setting up the program environment, and beginningexecution of t he application.When a Web page containing a Silverlight application is displayed, the user should be given a linkto download the plug-in from Microsoft if the plug-in is not already installed.

    11. What is Silverlight Runtime?

    Silverlight Runtime is a browser plug-in to support Silverlight enabled applications. If the Silverlightruntime is not installed, browsers will not be able to run Silverlight elements in the browser. You can

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    5/16

    set up your Silverlight tags in such a way that your browser will automatically prompt the user todownload and install the Silverlight plug-in when your application is launched in the browser.

    Installing the run time is a onetime operation on the client. Once installed, it will be automaticallylaunched when any Silverlight application is loaded in the browser.

    Note: Silverlight plug-in and the runtime, both are the same; however, I am giving two definitions here.

    12. What is Silverlight SDK?

    Silverlight SDK is a set of tools, documentation, samples, and templates for web developers to enablethem to easily develop Silverlight enabled applications. The SDK is not really mandatory to developSilverlight applications; however, the SDK will make development much easier.

    13. What are the tools required to develop Silverlight applications ?

    To run Silverlight applications in a web browser, you need to have the Silverlight runtime installed onthe client browser as a plug-in. This is a light-weight version of the .NET runtime.

    However, to develop a Silverlight application, you need something more.

    Silverlight SDK : This includes a set of tools required to compile and build Silverlight controls.

    If you are comfortable writing HTML using Notepad and compiling .NET applications from console tools,then you just need the Silverlight SDK to develop Silverlight applications.

    However, most people use some kind of IDE to develop applications faster .

    Microsoft offers two separate tools to develop Silverlight applications:

    Microsoft Expression Studio - This tool is meant for web designers to create rich visualelements for Silverlight applications. Expression Studio is recommended for web designers whocreate rich internet applicat ions with enhanced visual content and graphics. There are severalfeatures provided for creating enhanced graphics elements, with lot of options to pick color, font,

    etc.Microsoft Visual Studio - This is the integrated development environment from Microsoft todevelop .NET applications. Programmers can use Visual Studio to develop Silverlight applicationswhich require programming. Visual Studio allows programmers to develop sophisticated Silverlightapplications in any .NET language (like C#, VB.NET etc).

    Here are some other tools that you can use:

    Install Deep Zoom Composer - This tool allows you to prepare your images for use with theDeep Zoom feature in Silverlight 3.Download Silverlight Toolkit - This toolkit is a Microsoft project containing Silverlight controls,components, and utilities that can be downloaded and used in your Silverlight applications. Itincludes full source code, samples, and tests.Download .NET RIA Services - Microsoft .NET RIA Services simplifies the traditional n-tierapplication pattern by bringing together the ASP.NET and Silverlight platforms. RIA Servicesprovides a patt ern to write application logic that runs on the mid-t ier and controls acc ess todata for queries, changes, and custom operations.

    14. Which tool to use - Expression Studio or Visual Studio?

    If your Silverlight application includes just graphics and visual elements, then you can use ExpressionStudio. However, if you are a programmer and if your Silverlight application includes programming logic,then you might want to choose Visual Studio.

    15. What are the Silverli ht versions available so far?

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    6/16

    Silverlight 1.0: Silverlight 1.0, which was developed under the codename Windows PresentationFoundation/Everywhere (WPF/E), consists of the core presentation framework which isresponsible for the user interface (UI), interactivity, and user input, basic UI controls, graphicsand animation, media playback, Digital Restrictions Management (DRM), and DOM integrationSilverlight 2: Silverlight 2 (previously referred to as version 1.1) includes a version of the .NETFramework, implementing the same full Common Language Runtime (CLR) version as .NETFramework 3.0. The XAML markup as well as the code is compiled into .NET assemblies which arethen compressed using Zip and stored in a .xap file.Silverlight 3: Silverlight version 3 was released in July 9, 2009, which is an extension toSilverlight 2.0, and mainly provides improvements in graphics capabilities, media management,application development areas (additional controls, enhanced binding support, and out-of-browser functionality), and integration in the designers' Expression Blend 3 tools.Silverlight 4: Silverlight version 4 was released on April 15, 2010 (along with Silverlight 4 toolsfor developers ).

    16. What is a .xap file?

    A .xap file is a Silverlight-based application package ( .xap ) that is generated when the Silverlightproject is built. A .xap file is the compressed output file for a Silverlight application. The .xap fileincludes AppManifest.xaml , the compiled output assembly of the Silverlight project ( .dll ), and theresource files referred to by the Silverlight application:

    Web pages like .aspx files and .html files use Silverlight components by loading .xap files usingthe tag in HTML or by using the tag in ASP.NET pages.".xap " files (pronounced "zap") use the standard Zip compression algorithm to minimize clientdownload size.

    Rename this file to SilverlightTest.zip and open it using any decompression tool. You can see that thisis just like any other zip file, and it includes the project's output DLL and another file called" AppManifest.xaml ".

    17. How does XAP work?

    Once you have created the .xap file (explained below), t he Silverlight 2 plug-in downloads the file andruns it in a separate work space.

    18. How do I use a .xap file?

    A .xap file is used to contain and transfer the assemblies and resources of a managed code application.This managed code application must be run within the Silverlight 2 browser plug-in.

    19. Can we add a reference to a Class Library project in a Silverlightapplication project?

    No, you can't add a reference to a Class Library project to a Silverlight application project. You canonly add the reference of another Silverlight application project inside a Silverlight application project.

    However, you can add a reference to a Web Service or WCF Service.

    20. What is a Silverlight.js file?

    Silverlight.js is a helper file which enables websites to create advanced Silverlight installation andinstant iation experiences. Y ou can call the createObject and createObjectEx functions defined inthis file to embed the Silverlight plug-in in a web page.

    21. What is the use of the ClientBin folder?

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    7/16

    The ClientBin folder is used to place the .xap file of a Silverlight application. You can keep it anywherein your web application, but this is the default location used by Silverlight.

    22. How to change the default page of a Silverlight application?

    To change the default page of a Silverlight application, you need to set the RootVisual propertyinside the Application_Startup event of the App.xaml file.

    private void Application_Startup( object sender, StartupEventArgs e){ this .RootVisual = new MainPage();}

    23. What is XAML?

    XAML stands for eXtended Application Markup Language. XAML contains XML that is used todeclaratively specify the user interface for Silverlight or WPF applications. For example, if you need todisplay a rectangle, this is the XAML you need to use:

    Output:

    When the above XAML is executed, it will display a rectangle filled with red color. You may notice thatXAML is very similar to HTML in nature.

    XAML stands for eXtensible Applicat ion Markup Language , and is a declarative markup language thatfollows the XML rule and is used for developing User Interfaces in WPF and Silverlight technology. XAMLfiles are XML files that generally have the .xaml extension, and separates the UI definition from therun-time logic by using code-behind files, joined to the markup through partial class definitions.

    XAML has a set of rules that map object elements into classes or structures, attributes into propertiesor events, and XML namespaces to CLR namespaces. XAML elements map to Microsoft .NET types asdefined in referenced assemblies, and the attributes map to members of those types.

    24. What is the AppManifest.xml file?

    First, lets look at an example AppManifest.xaml file:

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    8/16

    The first element in AppManifest.xaml is a Deployment node. This node defines the application, andcontains the child AssemblyPart nodes.

    As you can see the AssemblyPart nodes define what assemblies (DLLs) are contained within the .xapfile, and give each of them a name.

    Now, if you look back up to the top, you'll see the Deployment node has the EntryPointAssemblyand EntryPointType attributes. The EntryPointAssembly attribute defines which assemblydefined below (as a child AssemblyPart node) is the main assembly (DLL) for the application. And,the EntryPointType attribute specifies the class contained within the assembly (DLL), defined in theEntryPointAssembly attribute, is t he main class that will be instantiated to start the application.

    The Deployment node also has a RuntimeVersion attribute that defines the version of Silverlightthe application is built for.

    25. What files are contained within the .xap file?

    The .xap file contains an application manifest ( AppManifest.xaml ) file and all the necessary DLLs thatare required by the application. The first DLL contained is the compiled version of your application andhas the same name of your application. In my test, I created an application named"SilverlightApplication1", so the DLL is named " SilverlightApplication1.dll ". The rest of the DLLs are thedependencies the application requires.

    26. What is app.xaml?

    App.xaml is a file used by Silverlight applications to declare shared resources like brushes, various styleobjects, templates etc. Also, the code-behind file of app.xaml.cs is used to handle global applicationlevel events like Application_Startup , Application_Exit , andApplication_UnhandledException (similar to the Global.asax file for ASP.NET applications).

    When Visual Studio creates the app.xaml file automatically, it creates a few event handlers with somedefault code. You can change the code appropriately.

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    9/16

    private void Application_Startup( object sender, StartupEventArgs e){}

    private void Application_Exit( object sender, EventArgs e){}

    private void Application_UnhandledException( object sender,

    ApplicationUnhandledExceptionEventArgs e){}

    For ASP.NET developers, the above code will look familiar. This is similar to the application level eventhandlers in Global.asax .

    27. What is the Silverlight official name?

    Silverlight was formerly code-named "WPF/E".

    28. What are the main features and benefits of Silverlight?

    Compelling cross-platform user experiences.Flexible programming model with collaboration tools.High-quality media, low-cost delivery.Connected to data, servers, and services.

    29. What is MainPage.xaml?

    When you create a Silverlight project using Visual Studio, it creates a default XAML file called"MainPage.xaml" . This is just a dummy start page created by Visual Studio, and it does not contain anyvisible UI elements. The default contents of the MainPage.xaml file looks like this:

    30. Which language is Silverlight developed in?

    It was developed using a combination of C# and C++.

    31. Can I consume WCF and ASP.NET Web Services in Silverlight?

    Yes, you can.

    32. What are Deep Zoom and Deep Zoom Composer?

    Deep Zoom provides the ability to interactively view high-resolution images in Silverlight. You can zoomin and out of images rapidly without affecting the performance of your application. Deep Zoom providessmooth in-place zooming and panning.

    DeepZoom Composer allows you to create high resolution image compositions which are built for smooth

    zoomin and annin . Dee Zoom Com oser is absolutel free and is sim le to use - ust loads in all

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    10/16

    your high resolution images and makes your composition on screen.

    Deep Zoom Composer is a tool that allows preparing of images for use with the Deep Zoom feature inSilverlight 3.

    33. What is the difference between WPF and Silverlight?

    Silverlight and Windows Presentation Foundation (WPF) are two different products from Microsoft, buthave lot of overlap. Silverlight is a subset of WPF in terms of features and functionality.

    Silverlight is a Microsoft technology, competing with Adobe's Flash, and is meant for developing richbrowser based internet applications.

    WPF is a Microsoft technology meant for developing enhanced graphics applications for the desktopplatform. In addition, WPF applications can be hosted on web browsers which offer rich graphicsfeatures for web applications. Web Browser Applications (WBA) developed on the WPF technology usesXAML to host user interfaces for browser applications. XAML stands for eXtended Application MarkupLanguage, which is a new declarative programming model from Microsoft. XAML files are hosted asdiscrete files in the Web server, but are downloaded to the browsers and converted to a user interfaceby the .NET runtime in the client browsers.

    WPF runs on the .NET runtime, and developers can take advantage of the rich .NET Framework andWPF libraries to build really cool Windows applications. WPF supports 3-D graphics, complex animations,hardware acceleration etc.

    Silverlight uses a particular implementation of a XAML parser, with that parser being part of theSilverlight core installation. In some cases, the parsing behavior differs from the parsing behavior inWindows Presentation Foundation (WPF), which also has a particular implementation.

    In table format:

    Silverlight WPF

    Definition Silverlight is Microsofts latest development platform forbuilding next-generation Web client applications.

    Windows PresentationFoundation (WPF) isMicrosofts latestdevelopment platform forbuilding next- generationWindows client applications.

    Subset of Silverlight is generally considered to be a subset of WPF,and is a XAML-based technology that runs within thesandbox of a browser plug-in.

    WPF is generally consideredto be a subset of .NETFramework, and is a XAMLbased technology.

    GUI Silverlight will be used in the development of RichInternet Applications (RIA) for web client users.

    WPF will be used in thedevelopment of Rich WindowsGraphical User Interfaces(GUI) for Windows clientusers.

    Support Cross OS, cross browser, cross device. Windows only.

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    11/16

    SoftwareRequired

    Silverlight is the add-on mechanism available for mostbrowsers; in order to run Silverlight applications at clientmachines, we need to install Silverlight software on theclient machine once.

    WPF, on the other hand,does not support any plug-inmechanism; instead, we needto install a completed WPFclient application in order touse the WPF applicat ion atthe client place.

    Frameworksupport

    Silverlight has a very small, its own rich base class libraryto make the plug-in as small as possible. It is highlyoptimized for size, and is a small subset of the full .NETFramework, to be embedded within an application.

    WPF, on the other hand, hasfull access to the main .NETFramework and all itsassociated assemblies.

    Deployment Silverlight applications are hosted within a web serverand a web page. To minimize client download size,Silverlight uses a XAP archive. A XAP archive is a zip-compressed archive of the Silverlight application, plus a

    manifest file describing the content. Visual Studioautomatically generates the XAP archive when using theSilverlight project template.

    WPF applications can bedeployed as standaloneapplications, ClickOnceapplications, or XAML

    browser applications.

    34. What is the difference between Silverlight and Flash ?

    Adobe Flash is the most popular competitor to Silverlight, supporting browser plug-ins and enabling theexecution of rich content for the Web. Flash is not a new technology, and already has had a long lifespan as compared to Silverlight. But it does not have a huge community as expected; it may bebecause of the limited development tools which are not known to most developers. Flash usesActionScript as the programming language and Flex as the programming environment, and most

    developers are far from these technologies.

    For ASP.NET developers, to extend their websites using Flash content is not so simple. They need tolearn a development environment like ActionScript and Flex . Apart from that , there is no way t ogenerate Flash content using server-side .NET code, which means its difficult to integrate ASP.NETcontent and Flash content.

    Silverlight aims to give .NET developers a better option for creating rich web content. Silverlightprovides a browser plug-in with many similar features to Flash , but one thats designed from the groundup for .NET. Silverlight natively supports the C# language, and uses a range of .NET concepts. As aresult, developers can write client-side code for Silverlight in the same language they use for server-side code (such as C# and VB), and use many of the same abstractions (including streams, controls,

    collections, generics, and LINQ).

    35. What is the difference between Silverlight and ASP.NET AJAX?

    Microsoft ASP.NET AJAX, a set of JavaScript libraries built into ASP.NET 3.5, is available as a separatedownload for ASP.NET 2.0. Being an integral part of ASP.NET 3.5 and the AJAX Controls Toolkit forASP.NET 3.5, now ASP.NET AJAX client-and server-side libraries are more integrated with Visual Studio2008. The client-side library allows you to implement client-level processing such as processing andvalidating information entered by the end user, refreshing a portion of the web page, and developingrich, interac tive user interfaces. Y ou can also efficiently integrate the c lient-side library c omponentswith the server-side ASP.NET controls library in asynchronous mode. The key technology driver of ASP.NET AJAX is scripting. In general, script-based web applications face several challenges due to

    different browser settin s e. . JavaScri t is not enabled b default on PCs and mobile devices. As a

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    12/16

    result, sc ripting is often not always the best strategy for enterprises to use to develop secure andscalable RIAs.

    ASP.NET AJAX supports limited features of RIAs, and does not support effective multimedia integration,managed code-behind integration, or metadata and information management. Microsoft ASP.NET AJAXis a widely accepted model for building RIAs, but it is very likely that, having Silverlight as an option,.NET developers will migrate ASP.NET AJAX applications to Silverlight RIAs. Visit www.asp.net/ajax/ if you want to learn more about Microsoft ASP.NET AJAX.

    36. What are the different Layout controls available in Silverlight?

    There are three different types of Layout controls provided by Silverlight:

    Canvas - Position child elements absolutely in x, y space.StackPanel - Position child elements relative to one another in horizontal or vertical stacks.Grid - Position child elements in rows and columns.

    You have to add a layout panel to every XAML page you create. All other UI elements must be addedinside one of the layout panels. Each page can have exactly one layout panel control.

    37. Are XAML files compiled or built at runtime?

    XAML files are usually c ompiled rather than parsed at runtime. But it also supports parsing duringruntime. When we build a XAML based project, you will see it creates a g.cs extension in the obi\Debugfolder. Therefore, for every XAML file, you will find a g.cs file. For instance, a MainPage.XAML will havea MainPage.g.cs file in the obi\Debug folder. In short, at run time, you actually do not see the XAMLfile. But if you want to do runtime parsing of the XAML file, it also allows that to be done.

    38. What is the long-term goal or vision for Silverlight?

    Microsoft Silverlight is a cross-browser, cross-platform, and cross-device plug-in for deliveringthe next generation of .NET based media experiences and rich interactive applications for theWeb.Silverlight offers a flexible programming model that supports AJAX, VB, C#, IronPython, andIronRuby, and integrates with existing Web applications.By using Expression Studio and Visual Studio, designers and developers c an c ollaborate moreeffectively using the skills they have today to light up the Web of tomorrow.By leveraging Silverlight's support for .NET, High Definition video, cost-effective advancedstreaming, unparalleled high-resolution interactivity with Deep Zoom technology, and controls,businesses can reach out t o new markets across the Web, desktop, and devices.

    39. Do I need to have the .NET Framework installed in order to useSilverlight?

    The answer to this is no - a cross platform version of the .NET Framework is included in the 6 MBSilverlight 4 download, which means you do not need to have anything extra installed on the client inorder to access Silverlight applications in the browser.

    The Silverlight version of the .NET framework includes the same CLR engine (same GC, type-system,JIT engine) that ships with the full .NET Framework, and a subset of the .NET Framework namespacelibraries. You can see the full list of all classes/namespaces that are included by opening up the ObjectBrowser when you create a new Silverlight application using Visual Studio.

    40. What are the other RIA technologies besides Silverlight?

    Adobe Flex, Java FX, Adobe Flash are some of the other RIA technologies besides Silverlight.

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    13/16

    41. What is meant by RIA?

    RIA stands for Rich Internet Applications, which are Web applications with rich user interfaces includingmedia elements such as audio, video etc. You can think of them as being similar to powerful and richdesktop applications, except that RIA applications are Web based.

    42. What is .NET RIA Services?

    Microsoft .NET RIA Services helps to simplify the n-tier application pattern by combining the ASP.NETand Silverlight platforms. RIA Services provides a pattern using which you can write application logicthat can run on the mid-t ier and controls ac cess to data for queries, changes, and custom operations.It also provides support for data validation, authentication, and roles by integrating with Silverlightcomponents on the client and ASP.NET on the middle tier.

    43. What are the design files and the code-behind files in Silverlight?

    The user interface elements of Silverlight applications are defined in XAML files. The logic andfunctionality of Silverlight applications is implemented using managed NET code-behind files that sharethe same class with the XAML file.

    44. Who is using Silverlight?Yahoo! Japan, NBC, Continental Airlines, NASA, Indian Premier League, and National Instruments aresome of the organizations currently using Silverlight to enhance their businesses.

    45. What features are missing from Silverlight presentation markup thatwill be supported in WPF?

    Some high-end Windows specific features of WPF, such as real 3D, hardware-based video acceleration,and full document support, will not be supported in Silverlight. This is by design in order to serveSilverlights cross-browser, cross-platform reach scenario that demands a light weight plug-in. Thatbeing said, Silverlight will offer a uniform runtime that can render identical experiences across browserson both Mac OS and Windows.

    46. Will I need more memory, a faster processor, or a better GraphicsProcessing Unit (GPU)?

    Microsoft designed Silverlight with the ability to deliver high-fidelity experiences on the broadest set of system configurations. Some features, such as HD video, may benefit from the power contained innewer personal computers.

    47. How does Silverlight make the Microsoft development systembetter?

    Silverlight is a cross-browser, cross-platform plug-in for delivering the next generation of mediaexperiences and rich interactive applications (RIAs) for the Web. Examples include:

    For ASP.NET-based Web applications, Silverlight provides a rich UI front-end that, with aconsistent programming model, adds support for richer interact ivity, media, and audio.For Microsoft SharePointbased c ontent, Silverlight offers the ability t o c reate rich Web Parts.For Windows Live services, Silverlight offers the ability to consume services and APIs moreeffectively.

    48. What is the relationship and difference between Silverlight andASP.NET?

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    14/16

    Technically, Silverlight and ASP.NET are completely different. The major differences are listed below:

    Silverlight runs completely on the client, while ASP.NET mainly runs on the server, but also has afew parts running on the client.When an event fires, Silverlight handles the event on the client, but in ASP.NET, the browser willmake an HTTP POST to the server, and after the server handles the request, it sends a newHTML page to the client.A Silverlight application sends rendering commands to the Silverlight rendering engine by eitherwriting XAML or code, and the Silverlight rendering engine will handle the rendering task. On theother hand, ASP.NET doesnt have a rendering engine. It generates an HTML file on the server,sends it to the client, and allows the browser to parse the HTML file and render the c ontent.Silverlight cant work with a database directly; instead, it consumes data from Web Services,while ASP.NET has strong support for working with databases directly.

    The most important thing to note is what runs on the client and what runs on the server, since this willaffect almost every part of your system. Silverlight runs on the client, and ASP.NET runs on the server.They can work together and are compatible with each other, but this requires some time and effort.

    49. When to use Silverlight, ASP.NET, or both?

    This depends on different scenarios. Below are some common approaches:

    Pure Silverlight

    One approach is to completely remove ASP.NET. This solution works best if youre working on anew development. You only need to work on Silverlight, without any worry about integrationproblems. If you need to communicate with the server, you write Web Services, such as WCF. Itwill also help you when you need to port part or whole of your system to another hosting or evenanother platform, since the client and the server are completely separate.

    Major ASP.NET, plus a Silverlight island

    This approach is generally used when the Silverlight content and the ASP.NET content have little

    relationship. For example, an ASP.NET blog engine with a Silverlight media player in a blog post.This approach is very easy to implement, and allows you to reach the broadest audience. Forexample, if a user hasnt installed Silverlight, he can still read the blog posts, but he cant watchthe videos.

    Use ASP.NET AJAX instead of Silverlight

    ASP.NET AJAX is designed to work with ASP.NET. It is mainly an extension to ASP.NET. WhileAJAX cant provide you the advanced user experience that Silverlight can, for many scenarios, itshould be sufficient. This approach also helps if you have strong ASP.NET experience, but are stillquite new to Silverlight.

    Within this approach, there are two branches. One is to mix the client and server code by usingthe UpdatePanel , AJAX Control Toolkit, and etc. The other method is to take the pure AJAXapproach, where you write HTML and JavaScript instead of using server controls, and call WebServices to communicate with the server. The former branch is easier to implement, especially if you have strong ASP.NET experience but lack JavaScript knowledge. The latter branch proves tobe bett er in an architecture when you want to port an AJAX application to other tec hnologiessuch as Silverlight, especially since you only need to rewrite the client side code, and can keepthe Web Services as they are. The programming model for the latter branch is similar toSilverlight. Therefore, this approach is rarely t aken if youre experienced in Silverlight.

    Mix Silverlight with ASP.NET

    More often, you may want to port an existing ASP.NET application to Silverlight, but you dont

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    15/16

    .

    mixing client side and server side technologies.

    Before going with this approach, please consider if the above approaches can solve your problem.Ask yourself the following questions:

    1. Do you really need a rich interac tive user experience?

    This is normally a requirement for consumer oriented applications, but for most businessapplications, you only need a good user experience, which AJAX is sufficient to provide.

    2. Can you add Silverlight islands to your exist ing ASP.NET application instead of mixing thecontents?

    This should work for most scenarios. For example, Windows Live Mail is built in ASP.NET,with a few Silverlight islands, such as a slideshow program that allows you to view photoatt achments with enhanced experience (ac tually, most Microsoft c reated web applicat ionstake this approach).

    3. Will this be a good chance to revise your architec ture?

    Most traditional ASP.NET applications use the B/S or three tire architecture in which theapplication works with a database either directly or through a business logic layer. Whenporting applications to other platforms, these architectures will introduce many problems.When investigating Silverlight, it is also a good chance to adopt SOA. Add a service facadelayer on top of the business logic layer, and you can work with the services from almostany client, such as an ASP.NET application and a Silverlight application. If you are alreadyon SOA, it should be trivial to port to Silverlight, since you only need to rewrite a clientapplication. With SOA, the ASP.NET AJAX approach and the Silverlight island approach willalso be much easier to implement.

    If none of the above approaches is suitable, you may have to mix Silverlight content withASP.NET. When using this approach, keep in mind that Silverlight cant call ASP.NET server-sideevent handlers, and each post back (either partial or complete) will cause the Silverlightapplication to reload.

    50. What are the new features of Silverlight 4 ?

    Support for Google's Chrome browser.Web cam and microphone support.Printing support.Full keyboard ac cess while running in full-screen mode.Programmatic access to a user's local document folder.Improved mouse support, including right button support and mouse wheel support.Elevated trust and support for local Component Object Model (COM) objects.New notification support to display messages to end users.New and enhanced controls such as a RichTextBox and an enhanced DataGrid control.New support for implic it t heming of c ontrols.New hosted browser support for rendering HTML inside Silverlight.WCF data layer enhancements.Localization enhancements with bi-directional text.Support for Managed Extensibility Framework .Enhanced data binding support.Enhanced animation effec ts.Clipboard and drag and drop support.Deep Zoom performance enhancements.WCF Rich Internet Application (RIA) Services.Content protection for H.264, and support for playing offline DRM protected media.

  • 8/4/2019 Basic Questions on Silver Light Technology - Code Project

    16/16

    Permalink | Advertise | Privacy | Mobile

    | Web21 | 2 .3.110 630 .1

    A rticle C opyright 201 0 by keesari_anjaiah

    Eve rything else C opyright CodeProject , 1999-2 011

    Terms of Us e

    Conclusion

    I hope you enjoyed this article; please do not forget to write your comments on this article, which willhelp me to improve in future articles.

    Thank you so much for reading this article.

    License

    This article, along with any associated source code and files, is licensed under The Code Project OpenLicense (CPOL)

    About the Author

    keesari_anjaiah

    Software Developer(Senior)TCS

    India

    Member

    Anjaiah Keesari is working as a Senior Software Engineer has more than 6years experience working on ASP.NET, C#,VB.NET,AJAX, Silverlight, XAML,MVC and SQL Server. I hold Master's degree in Computer Science. I will bereachable at [email protected]. I like coding

    Comments and Discussions

    31 messages have been posted for this article Visithttp://www.codeproject.com/KB/silverlight/QuestionsOnSilverlight.aspx to post and viewcomments on this article, or click here to get a print view with messages.