News

Silverlight Just Won't Die: 'XAML for Blazor' Arrives

Userware is using vestiges of the long-gone and sorely missed Microsoft Silverlight web-dev platform to power its new "XAML for Blazor" offering, which lets .NET developers use markup language within client-side Blazor applications.

The French software company made a name for itself by offering up OpenSilver, an open source replacement for Silverlight, after it was killed by Microsoft.

Silverlight was a popular framework for which Microsoft officially discontinued support in October 2021, though its much earlier deprecation led to a lot of angst from a devoted developer following that complained about becoming heavily invested in the framework only to see it pulled out from under them (see the article, "A Decade Later, .NET Developers Still Fear Being 'Silverlighted' by Microsoft").

Userware, along with some other third parties, sought to keep Silverlight tech alive, with the latest example of that being XAML for Blazor. That's as opposed to web tech (HTML/CSS) for Blazor, which is Microsoft's favored approach. Daniel Roth, principal program manager for ASP.NET, said as much last year: "We understand that XAML is a popular technology for UI development, but for ASP.NET Core & Blazor our focus is on HTML & CSS based web development. For folks interested in XAML based web development we recommend engaging with the various XAML based communities: Uno, Avalonia, OpenSilver, .NET MAUI."

[Click on image for larger view.] XAML for Blazor NuGet Package (source: Userware).

So, for those who prefer the XAML approach (but apparently don't want to use the mobile-centric .NET MAUI), XAML for Blazor comes via a NuGet package that lets devs leverage XAML files and Razor files side-by-side, rendering XAML as plain HTML in the same DOM. As of now, it works only with the client-side component of Blazor, called Blazor WebAssembly. Optionally, a corresponding Visual Studio extension in the IDE's marketplace can add templates to the "Add New Item" dialog of Visual Studio, facilitating the creation of new XAML files from within Blazor projects.

"Our goal with XAML for Blazor is to solve the challenges developers face in integrating existing XAML-based applications with web applications, and helping to bridge the gap between desktop and web development," Userware CEO Giovanni Albani said in announcing the tool on Reddit, where it was received with mostly skepticism, judging from many snarky and some profane comments.

Userware listed the following benefits and use cases for XAML for Blazor:

  • Developers with a preference or expertise in XAML can now leverage their skills within Blazor applications. They can use familiar XAML features such as MVVM, Binding, Styling, Templating, Panels, Custom Controls, and more.
  • Migrating or reusing code from existing XAML-based applications, such as WPF, Silverlight, UWP and WinUI apps, becomes more streamlined with XAML for Blazor's near feature-parity with Silverlight and close similarity with the other technologies.
  • XAML for Blazor provides access to powerful XAML controls like DataGrid and DataForm, as well as the enterprise-focused features of OpenSilver, including RIA Services, WCF SOAP, PRISM, MEF, and more.

"Our experience building OpenSilver since 2014 and migrating large Enterprise apps from Silverlight has provided us with invaluable insights into rendering XAML in HTML and handling complex interoperability scenarios," Userware said this week.

Known limitations, in addition to lack of server-side support at this time, include:

  • Requires .NET 7 or .NET 8. Presently tested only on Visual Studio 2022 on Windows.
  • Devs can place XAML files and Razor files side-by-side within the same Blazor project, but cannot mix and match snippets of XAML and snippets of Razor within a single file yet.
  • The primary supported dialect of XAML is that of Microsoft Silverlight (documentation), which is a browser-friendly subset of WPF. Porting snippets of XAML from WPF, UWP or WinUI is relatively easy. Porting from Xamarin Forms or .NET MAUI requires more substantial work.

XAML for Blazor comes in a free edition that doesn't allow commercial use or Professional and Enterprise editions for which pricing varies.

To help developers get started with the new offering, Userware published "Getting Started" documentation along with an associated example app on GitHub.

The company's future plans for the offering include extending support to Blazor Server, enriching documentation and examples, and introducing a UI designer.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

Subscribe on YouTube