Showing posts with label SilverLight. Show all posts
Showing posts with label SilverLight. Show all posts

Thursday, May 27, 2010

Silverlight 4

Question :: What features are missing from Silverlight presentation markup that will be supported in the Windows Presentation Foundation?
Ans::Microsoft recommends the Windows Presentation Foundation for building rich immersive applications and experiences that can take full advantage of the Windows platform, including UI, Media, offline communication, OS integration, Office integration, peripheral access, Document support and more. Silverlight will be used for broad reach interactive media content and browser-based rich interactive and high-performance applications and experiences.

Question :: When would a customer use Silverlight versus Windows Presentation Foundation? Is Silverlight for a certain type of application?
Ans::For ASP.NET-based Web applications, Silverlight provides a rich UI front-end that, with a consistent programming model, adds support for richer interactivity, media, and audio.
For Microsoft SharePoint–based content, Silverlight offers the ability to create rich Web parts. For Windows Live services, Silverlight offers the ability to consume services and APIs more effectively.

Question :: How does Silverlight make the Microsoft development system better?
Ans::Silverlight is a cross-browser, cross-platform plug-in for delivering the next generation of media experiences and rich interactive applications (RIAs) for the Web.

Question :: When would a customer use Silverlight instead of ASP.NET AJAX?
Ans::Silverlight integrates with existing Web applications, including ASP.NET AJAX applications. Consequently, ASP.NET AJAX and Silverlight are designed to be complementary technologies. In the broader sense, Silverlight can talk to any AJAX application, both client-side and server-side. ASP.NET AJAX can additionally be used to control Silverlight-based visualization of data or delivery of rich experiences. Examples might include mapping applications or video playback with rich presentation.

Question :: Are the features of the Macintosh and Windows releases of Silverlight fully compatible?
Ans::yes

Sunday, May 23, 2010

Silverlight 3

->Can SilverLight run in other platforms other than window?
Yes, animations made in SilverLight can run in other platforms other than window. In whatever platform you
want run you just need the SilverLight plug-in.

->What is the relationship between Silver Light, WPF and XAML?
XAML is a XML file which defines the UI elements. This XML file can be read by WPF framework or Silver light framework for rendering. Microsoft first developed WPF and they used XAML files to describe the UI elements to the WPF framework. Microsoft then extended WPF and made WPF/e which helped to render the UI in the browser. WPF/e was the code name for Silver Light. Later Microsoft launched Silver Light officially.
So the XAML just defines the XML structure to represent the UI elements. Both the frameworks i.e. WPF and Silverlight then reads the UI elements and renders the UI elements in the respective platform.

->Even WPF runs under browser why SilverLight?
Yes there is something called as WPF browser application which can run WPF in browser. For WPF browser application you need .Net framework to be installed in the client location while for silver light you need only the plug-in. So in other words WPF browser applications are OS dependent while SilverLight is not. SilverLight plug-in can run in other OS other than windows while we all know .NET framework only runs in windows.

->What is the difference between Silverlight 1 and Silverlight 2
Nothing, Silverlight 2 is a full superset of Silverlight 1.0 - it is 100% compatible with Silverlight 1.0 applications and provides significantly more powerful features and functionality. Silverlight 1.0 applications even benefit from improvements in media playback and performance characteristics of Silverlight 2 with no additional work.

->What kind of audio video formats are supported in Silverlight?
Silverlight supports Windows Media Audio and Video (WMA, WMV7-9) and VC-1, as well as MP3 audio.

->What is Silverlight Tool Kit?
To create an application or game you need to design, code and give some extra feature to your output.
To do the above, you need some controls, IDE etc.
Silverlight Tool kit is nothing but is a collection of Silverlight Tools, Components etc. It includes source code describing the all you need to develop an application.
The Silverlight Toolkit is a collection of Silverlight controls, components and utilities made available outside the normal Silverlight release cycle. A product of the Microsoft Silverlight product team, the Silverlight Toolkit adds new functionality quickly for designers and developers, and provides the community an efficient way to help shape product development by contributing ideas and bug reports. It includes full open source code, unit tests, samples and documentation for over 26 new controls covering charting, styling, layout, and user input.

->Can I add more than one .xaml pages in silverlight application?
Yes, you can have multiple .xaml files in a single project.In the App.xaml, in the method Application_Startup you can choose, which page you want to initially display.

Silverlight overview

Silver light has borrowed lot of things from existing Microsoft technologies. We can think silver light plug-in as a combination of some technologies from core .NET framework, vector animations, media and JavaScript.
 

So we can visualize the silver light architecture as combination of some functionalities from core .NET framework , Ajax and some functionalities like animation , media etc provided by core silver light framework.
We can think silver light architecture as a combination of four important blocks:-
• Some .NET framework components: - Silver light uses some components from .NET framework. One of the main components is WPF. Many of the UI components ( check box , buttons , text boxes etc) , XAML parsing etc are taken from the core WPF system. It also has taken components like WCF to simplify data access. It also have CLR for memory management, safety checking and garbage collection. The base class libraries of Net are used for string manipulations, algorithms, expressions, collections and globalization.
• Presentation core: - The core presentation framework has functionalities to display vector 2d animations, images, media, DRM and handle inputs like mouse and keyboard.
• Other technologies: - Silver light interacts with other technologies like Ajax and javascript. So it also borrows some functionalities from there technologies.
• Hosting: - Silver light animations finally run under the browser environment. So it has a the hosting functionality which helps to host the application the browser , expose a DOM by which JavaScript can manipulate the silver light components and it also has a installer functionality which helps to install silver light application and plug-in in the browser environment.
One of the things which you can notice from the architecture diagram is that the presentation core reads from the XAML file for rendering. The XAML is a component which is a part of the .NET framework and the rendering part is done by the presentation core.



The application is a typical HTML which runs under the browser. There are markups which instantiates the silver light plug-in. Now when user interacts with the silver light application it sends event to JavaScript system or the .NET system. This depends on which programming language you are using. The program code which is either in JavaScript of .NET can make calls to the silver light run-time and achieve the necessary functionalities. XAML will be read and parsed by the silver light runtime and then rendered accordingly to the browser.

Silverlight 2

->How to set Silverlight contents width as 100%?
Generally you can't set the UserControl width in % like 100% so that the Silverlight contents can spread in the
full screen.To get the 100% width of the screen you can set
width="auto" and height="auto".

->Can you provide a list of Layout Management Panels and when you will use them?
Canvas Panel:-use a canvas for simple layouts and when there is no need to resize panel. Controls can overlapped each other when resizing the panel.
Stack Panel:-use this for grouping controls in a stack (horizontal/vertical). Controls do not overlapped.
Grid Panel:-most flexible, multi row/columns layouts. Similar to a HTML table

->How can style elements be applied? (similar to a CSS file/skins)
Styles elements are supported in the form of application resources. An app.xaml file can be created containing an application resource Xml construct. The target type for each style is set to the control on which the style
needs to be applied.

App.xaml:
Application.Resource>
Style x:Key="MyBorder" TargetType="Border">
setter property="width" value="5">
/style>

Page.xaml:
Border Style="{StaticResource MyBorder}">
...
/Border>

->Can we add normal project reference (normal class library) to the Silverlight project?
No

->Is ADO.NET objects supported in Silverlight Project?
No, Silverlight project doesn't support normal ADO.NET objects like DataTable, DataSet, DataColumn, Database connection providers like SqlConnection, OledbConnection objects.
You can use System.Data namespace but that contains Services related stuffs not ADO.NET stuffs.

Silverlight 1

   
What is name of Linux version of silverlight ?
 LinLight

What is the difference between WPF and SilverLight?
SilverLight is a browser plugin for running it on web where WPF is used for window application. Though they both make use of XAML.

How to perform Event handling in silver light?.
Silverlight 1.0 uses JavaScript, while Silverlight 2.0 onwards uses C# (managed code) for event handling.

What are the Silverlight Event Mode?
In Silverlight, there are two event cases:
Input events
Non-input events.
Input Events: The browser that hosts the Silverlight plug-in handles initial input stimulus for the input events. This is because Silverlight works within the plug-in architecture of the hosting browser. From the browser, the event is sent to the Silverlight plug-in.
Then, it is raised as an event in the Silverlight Object Model.
Non-input Events: They report a state change to a particular object, for example, the state change events that report asynchronous download state or progress of actions initiated by Web Client. Some non-input events provide lifetime information of objects at a framework level.

For example the FrameworkElement.Loaded event
Some events, such as OnError, can only be handled by the Silverlight plug-in instance and exist within the HTML Document Object Model (DOM). These events need to be continually exposed and possibly handled by any script working with the plug-in instance in the DOM. Therefore; these events are not passed to the managed programming model.

Can we add the reference of a Class library project in Silverlight application project?
No, You can't add the reference of a Class library inside the Silverlight application project. You can only add the reference of another Silverlight application project inside a Silverlight application project.
However, you can add the reference of a Web Service or WCF services.

What is Silverlight.js file?
Silverlight.js is a helper file which enables Web sites to create advanced Silverlight installation and instantiation experiences.

What does XAP mean?
XAP (pronounced ZAP) is the file extension for a Silverlight-based application package (.xap). This file contains the compressed assemblies and resources of a Silverlight  application.

What is a .xap file?
A .xap file is a Silverlight-based application package (.xap) that is generated when the Silverlight project is built.

How does XAP work?
Once you have created the .xap file, the Silverlight  plug-in downloads the file and runs it in a separate work space.

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  browser plug-in.

How can I view the contents of a .xap file?
To view the contents of a .xap file you can rename the extension of the .xap file to .zip. Then view the .zip file using any standard .zip utility.

What are the files contained in the .xap file?
A basic xap file will have an assembly related to specific code for the application, an application manifest file and any additional assemblies need to run the application. At a minimum, two files are needed, the application manifest file and the application assembly.
For example:
AppManifest.xaml
MyPianoV2.dll

What is contained in the AppManifest.xaml file?
The AppManifest.xaml file contains the deployment details needed to run the application.
The AppManifest.xaml file defines the assemblies that get deployed in the client application. This file is automatically updated when compiling your application. Based on the settings of a referenced assembly it is added to the Application manifest. For example, if you have an assembly that you are referencing in your application but do not wish to have it included into the. XAP file you can choose to set “Copy Local” to false.

Basic example:

                 Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="MyPianoV2" EntryPointType="MyPianoV2.App" RuntimeVersion="2.0.30523.4"
  Deployment.Parts   
AssemblyPart x:Name="MyPianoV2" Source="MyPianoV2.dll" /  
/Deployment.Parts
/Deployment

.XAP generation tool:
When you use the Silverlight project template in Visual Studio 2008 the .XAP file gets generated automatically for you. This is done in a post-build action that uses a tool called Chiron; a tool that gets installed with the Silverlight .
The Chiron tool can also be accessed via the command line to package your own .XAP files if needed. You can also use this tool to generate the .XAP for a DLR application.

What are the requirements to display the contents of the .xap file when I run the application in a Web page within the browser?
·         Make sure you are using the Silverlight  plug-in.
·         Make sure you have the XAP mime type set for IIS .
·         Make sure you included your resources, such as graphics, with your Silverlight Application
·         Make sure the .xap file is contained in the ClientBin folder of your Web application.

What is the XAP mime type?
The .xap mime type is:
application/x-silverlight
 

How do I run the Silverlight application (including the .xap file) with the Silverlight  plug-in?
You can use the ASP.NET Silverlight Server Control to reference your .xap file. Specifically, you use the Source property to reference the XAP application package. The Version must be set as well.

What is the XmlXapResolver class?
The XmlXapResolver class is used to resolve resources that are contained in the Silverlight application’s XAP package.

What is the use of ClientBin folder?
ClientBin folder is used to place the .xap file of Silverlight application. You can keep this anywhere in your web application but this is the default that is used by the Silverlight.

What is the parent xaml tag of Silverlight page?
UserControl is the parent xaml tag of the Silverlight page. All other tags are placed under UserControl tag.

UserControl x:Class="SilverlightApplication2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300";

Grid x:Name="LayoutRoot" Background="White"
/Grid
/UserControl
   

How to change the default page of the Silverlight application?
To change the default page of Silverlight application, you need to set the RootVisual property inside the Application_Startup even of App.xaml file.

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

When you create a new project in Silverlight through Visual Studio, how many xaml files are created and what are the uses of those files?
When we create a Silverlight application from Visual Studio, two (2) xaml files are created into the Silverlight project.
They are:
1. App.xaml - App.xaml is a file used to declare shared resources like brushes, various style objects etc. and to handle the global application level event (this is almost similar to global.asax file in asp.net application). By default following events are created in the App.xaml.cs file.
Application_Startup
Application_Exit
Application_UnhandledException
ReportErrorToDOM

2. MainPage.xaml or Page.xaml - This page is the default page of the Silverlight application and when the silverlight application runs this becomes the default page to appear (this page is like the default.aspx page of asp.net application)

Which programming language can be used to write the backend of the Silverlight application?
We can either use C# or Visual Basic to code the backend of the silverlight application. Here backend means the code behind files for the Sivlerlight pages.

Which language is used to design the layout in Silverlight?
XAML language is used.
Extensible Application Markup Language (XAML, pronounced zammel ) is a declarative XML-based language created by Microsoft which is used as a user interface markup language to define UI elements, data binding, eventing, and other features.