Silverlight difference faqs- 2


Published on

This provides a list of Silverlight FAQs-2 which are of "Difference between" kind

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Silverlight difference faqs- 2

  1. 1. 1.Difference between Custom Control and User Control in Silverlight S.No Custom Control User Control 1 A loosely coupled control w.r.t A tightly coupled control w.r.t code code and UI and UI 2 Derives from Control Derives from UserControl 3 Defines UI in the Defines UI as a normal XAML ResourceDictionary 4 UI can be skinable Child controls can skinable only 5 Has Dynamic layout Has static layout 6 UI can be changed in different UI is fixed and cant have different project look in every project 7 Has full toolbox support Cant be added to the toolbox 8 Defines a single control Defines a set of controls 9 More flexible Not much flexible like Custom Control 10 Requires in depth knowledge of Does not require depth knowledge of Silverlight UI Model UI Model2.Difference between DataContext and ItemsSource property in Silverlight S.No DataContext property ItemSource property 1 DataContext expects an object ItemsSource expects IEnumerable type type objects 2 DataContext is a dependency ItemsSource is defined by the property is exposed by ItemsControl class. All the descendants FrameworkElement base class of FrameworkElement can utilize the DataContext property and set an object to its value. Note: But we can only set a type of IEnumerable(or instance of class that derives from). 3 DataContext does not generate In terms of ItemsSource property, it is template, it only used to hold mainly used to generate template common data for other controls to regardless of you set it in XAML or in bind. the code behind. 4 DataContext is mainly used to But for ItemsSource, it is not used to hold common data that other child share data in the visual tree. It is only
  2. 2. want to share. Thus it can be valid for the element that defined. inherited by other child elements There is still one thing to be noted is without problem. that the child element can override the DataContext of the perent DataContext no mater directly or indirectly.Example(s):Suppose we have a Person Class which has a property Name. Now in Xaml we can say like:<StackPanel x:Name="Parent"><StackPanel.Resources><local:Person x:Key="person"></StackPanel.Resources><ListBox ItemsSource="{Binding Source={StaticResource person}}"><ListBox.ItemTemplate><DataTemplate><TextBox Text="{Binding Path=Name}"/></DataTemplate></ListBox.ItemTemplate></ListBox></StackPanel>If you run this code in the ListBox you will get to see values depending on List<Person> object. Butif we change the ItemsSource to DataContext then you will be not able to see anything becauseDataContext doesnt generate templates in any cases. If you set datacontext still you have to set theItemsSource property like this:<ListBox DataContext="{Binding Source={StaticResource person}}" ItemsSource="{Binding}">Summary:In a word, if we have several child elements that will share a common data source, we can setDataContext property for the parent elements. And we use ItemsSource for ItemsSource in mostcased to generate template. Like:<StackPanel DataContext="{Binding Person"}><TextBox Text="{Binding FName}"/><TextBox Text="{Binding LName}"/></StackPanel>3.Difference between Silverlight and Flex S.No Silverlight Flex 1 Execution Mechanism: Execution Mechanism: Power of Native execution of Slow execution for iterative executions CLR instead of Flashs Action Script Interpretator
  3. 3. 2 Editing facility: Editing facility: Expression Blend is really cool Flex Builder is not that much good and more advanced editor then editor when compare with Expression Flex Builder Blend3 Multilanguages Support: Multilanguages Support: Power of other languages, No generics, No other languages, No provides Generics and Linq etc linq.4 Threading and Asynchronous Threading and Asynchronous Tasks: Tasks: Unavailable Available5 Form layouting and binding: Form layouting and binding: Binding in Silverlight is way more Better in Adobe Flex.The most easy cumbersome.Binding requires way to create new components, you component naming and does not can have mxml derive from any support instance expressions like control and extend them with extensive flex does, though two way binding. binding is good in silverlight but you have to write long codes for multiple bindings for one math expression.6 Where primarily used: Where primarily used: Silverlight is used for extremely We use flex for data applications, those rich graphics and animation are simple form processing applications7 Search Engine Friendly: Search Engine Friendly: XAML is Search Engine Friendly MXML markup language is not Search Engine Friendly8 Client / Server Technology: Client / Server Technology: Silverlight can be developed for a Flex is a client based application tool server or client environment.9 Release Date: Release Date: Before it was called Silverlight, it Adobe Flex was originally released in was known as Windows 2004 by Macromedia. The third Presentation version (Flex Builder 3) became Foundation/Everywhere (WPF/E) available in 2008. and was first released in 2007. Silverlight 2 became available in October 2008. Silverlight 3 was
  4. 4. released in July 2009. 10 Language Differences: Language Differences: Alternatively, Microsoft Adobe Flex uses MXML markup Silverlight uses the XAML language and actionscript to build language as a placeholder for layout/graphic user interfaces. To media files, shapes and images. It create components, it works with works with all .NET languages ActionScript (the object oriented Flash and JavaScript for interactive and language). After the code is completed, component features. Completed it needs to be compiled by the Flex code is compiled with the .NET Application Server. assemblies and compressed into a ZIP file. 11 Data Transfer: Data Transfer: No such format for data transfer. Data transfer via the proprietary AMF Will have to stick to SOAP and using WebORB, Fluorine, etc is faster REST web services(for now). than traditional web services. 12 Debugging: Debugging: Debugging using Visual Studio is Debugging is a bit of a hassle. very easy. 13 Webservice Access: Webservice Access: Accessing web services is very Accessing web services requires easy. Just add a reference to the manual creation of ActionScript proxy WebService in Visual Studio and classes. We can automate this by using lookup reference.cs for the good FlexTense though. stuff 14 Componenet Size: Component Size: Size of the Silverlight component Size of the compiled SWF file is is larger. smaller than that of the uncompressed Silverlight component.And, further updates on difference between questions and answers, please visit my blog @