Difference Between WPF and Microsoft Silverlight

Windows Presentation Foundation (WPF) and Microsoft Silverlight both can be used to develop rich internet applications based on XAML Framework. However, depending upon how you want your project to shape up, you need to choose between the two or integrate them.

An overview

WPF has provided developers a unified programming model that has a new graphical user interface (GUI) framework replacing the old “Windows Forms” and Win32 API. Its vector based and graphics processing unit (GPU) enabled drawing framework (DirectX) has the ability to create richer UIs with media and documents than does the Windows Forms. Using a declarative-based language XAML specifying vector-based graphics able to scale and take advantage of hardware acceleration, WPF can render a new level of user experience. One gets a consistent programming model for application building with a clear separation between the business logic and the user interface.

Microsoft Silverlight, a cross-browser and cross-platform implementation of Framework, is a small and lightweight hosting technology delivering next-gen rich interactive media and content over the web and developing browser-hosted rich internet applications (RIAs) that could integrate data and services from several sources. It also builds applications enhancing the typical end-user experience fairly significantly if you compare them with the traditional web applications.

How they differ

While WPF leverages the Framework and executes on the common language runtime (CLR), Silverlight is based only on a subset of XAML and the Framework executing on a browser-hosted version of the CLR. Hence, a lot of basic approaches building WPF applications fail in Silverlight. It supports little of the WPF component primitives and provides only one type of layout. So, if an existing WPF application is to be ported to Silverlight, it would mean rewriting of the whole UI-related code.

See also  Exploring the Diverse Applications of Generative AI

WPF applications run as standalone desktop programs or can be hosted in a website as an embedded object (on Windows only). However, browsers-based WPF applications (running only on Internet Explorer and Firefox on Windows) lose access to some functions and that does not happen with desktop applications. On the contrary, deployment of Silverlight applications can be done on more platforms (Windows, OS X, and Linux) and more browsers. Small and lightweight applications, they consume less infrastructure.

Conclusion

Though built on peaks of different run-time stacks, WPF and Silverlight share many common capabilities and features. Silverlight embeds WPF to provide web controls with more focus on a UI object model and less on animation. Alone, it misses many 3D functions and lacks widgets. Out of many such missing elements in Silverlight is the GUI. Many missing WPF Framework features in Silverlight give rise to subtle differences that have to be carefully considered when moving an application between Silverlight and WPF or when building an application that targets both WPF and Silverlight.