8.12.2012

Silverlight Difference FAQs-2

1.Difference between Custom Control and User Control in Silverlight
S.No
Custom Control
User Control
1
A loosely coupled control w.r.t code and UI
A tightly coupled control w.r.t code and UI
2
Derives from Control
Derives from UserControl
3
Defines UI in the ResourceDictionary
Defines UI as a normal XAML
4
UI can be skinable
Child controls can skinable only
5
Has Dynamic layout
Has static layout
6
UI can be changed in different project
UI is fixed and can't have different look in every project
7
Has full toolbox support
Can't 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 Silverlight UI Model
Does not require depth knowledge of UI Model

2.Difference between DataContext and ItemsSource property in Silverlight

S.No
DataContext property
ItemSource property
1
DataContext expects an object type
ItemsSource expects IEnumerable type objects
2
DataContext is a dependency property is exposed by FrameworkElement base class
ItemsSource is defined by the ItemsControl class. All the descendants 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 template, it only used to hold common data for other controls to bind.
In terms of ItemsSource property, it is mainly used to generate template regardless of you set it in XAML or in the code behind.
4
DataContext is mainly used to hold common data that other child want to share. Thus it can be inherited by other child elements without problem.
But for ItemsSource, it is not used to share data in the visual tree. It is only valid for the element that defined. There is still one thing to be noted is 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:


If you run this code in the ListBox you will get to see values depending on List object. But if we change the ItemsSource to DataContext then you will be not able to see anything because DataContext doesn't generate templates in any cases. If you set datacontext still you have to set the ItemsSource property like this:


Summary:

In a word, if we have several child elements that will share a common data source, we can set DataContext property for the parent elements. And we use ItemsSource for ItemsSource in most cased to generate template. Like:


3.Difference between Silverlight and Flex
S.No
Silverlight
Flex
1
Execution Mechanism:

Power of Native execution of CLR instead of Flash's Action Script Interpretator
Execution Mechanism:

Slow execution for iterative executions
2
Editing facility:

Expression Blend is really cool and more advanced editor then Flex Builder
Editing facility:

Flex Builder is not that much good editor when compare with Expression Blend
3
Multilanguages Support:

Power of other languages, provides Generics and Linq etc
Multilanguages Support:

No generics, No other languages, No linq.
4
Threading and Asynchronous Tasks:

Available
Threading and Asynchronous Tasks:

Unavailable
5
Form layouting and binding:

Binding in Silverlight is way more cumbersome.Binding requires component naming and does not support instance expressions like flex does, though two way binding is good in silverlight but you have to write long codes for multiple bindings for one math expression.
Form layouting and binding:

Better in Adobe Flex.The most easy way to create new components, you can have mxml derive from any control and extend them with extensive binding.
6
Where primarily used:

Silverlight is used for extremely rich graphics and animation
Where primarily used:

We use flex for data applications, those are simple form processing applications
7
Search Engine Friendly:

XAML is Search Engine Friendly
Search Engine Friendly:

MXML markup language is not Search Engine Friendly
8
Client / Server Technology:

Silverlight can be developed for a server or client environment.
Client / Server Technology:

Flex is a client based application tool
9
Release Date:

Before it was called Silverlight, it was known as Windows Presentation Foundation/Everywhere (WPF/E) and was first released in 2007. Silverlight 2 became available in October 2008. Silverlight 3 was released in July 2009.
Release Date:

Adobe Flex was originally released in 2004 by Macromedia. The third version (Flex Builder 3) became available in 2008.

10
Language Differences:

Alternatively, Microsoft Silverlight uses the XAML language as a placeholder for media files, shapes and images. It works with all .NET languages and JavaScript for interactive and component features. Completed code is compiled with the .NET assemblies and compressed into a ZIP file.
Language Differences:

Adobe Flex uses MXML markup language and actionscript to build layout/graphic user interfaces. To create components, it works with ActionScript (the object oriented Flash language). After the code is completed, it needs to be compiled by the Flex Application Server.

11
Data Transfer:

No such format for data transfer. Will have to stick to SOAP and REST web services(for now).
Data Transfer:

Data transfer via the proprietary AMF using WebORB, Fluorine, etc is faster than traditional web services.
12
Debugging:

Debugging using Visual Studio is very easy.
Debugging:

Debugging is a bit of a hassle.
13
Webservice Access:

Accessing web services is very easy. Just add a reference to the WebService in Visual Studio and lookup reference.cs for the good stuff
Webservice Access:

Accessing web services requires manual creation of ActionScript proxy classes. We can automate this by using FlexTense though.
14
Componenet Size:

Size of the Silverlight component is larger.
Component Size:

Size of the compiled SWF file is smaller than that of the uncompressed Silverlight component.

No comments:

Post a Comment