News
'F# Meets XAML' in Open Source Silverlight Alternative, OpenSilver 2.1
OpenSilver, an open source alternative to the long-gone Microsoft Silverlight, continues to add new language support to its XAML-based web application framework.
After adding support for VB.NET (in addition to C#) last October (see the Visual Studio Magazine article, "OpenSilver 2.0 Weds VB.NET with XAML for Web Apps"), corporate backer Userware today (Feb. 6) announced support for F#, Microsoft's functional-first programming language, in a new v2.1 update.
OpenSilver was created as an open source alternative to Microsoft Silverlight, a once-popular, cross-platform framework for creating multimedia-rich and interactive web applications that was discontinued by the company years ago to the dismay of many developers. OpenSilver is delivered via an Visual Studio SDK extension.
The Paris-based Userware this week said that blending F# and XAML combines the powerful functional programming of F# with the rich, declarative UI capabilities of XAML, providing a "unique synergy" promising faster development times, fewer bugs and more readable code.
"Why F#?" a blog post asks. "The integration of F# in OpenSilver 2.1 bridges the gap between functional programming and the development of rich, interactive web UIs. This unique combination allows developers to enjoy the benefits of both worlds: the expressive and concise syntax of F#, and the powerful, declarative nature of XAML for UI design."
That results in code like this:
Userware described the move as "a novel approach in web app development" that aligns with an industry shift toward more flexible and efficient frameworks while simultaneously enhancing OpenSilver's capabilities and also providing innovation opportunities within the .NET community.
"With this new update, developers can now include files such as 'App.xaml 'and 'MainPage.xaml' along with their F# code-behind counterparts ('App.xaml.fs,' 'MainPage.xaml.fs') in a single project," the company said. "This integration allows them to harness the strengths of both XAML and F#: XAML is well-suited for defining user interfaces, its declarative nature and templating system aiding in the design of complex UIs. Additionally, the forthcoming GUI designer for OpenSilver is expected to further streamline this process."
Speaking of forthcoming, future planned features include a WYSIWYG XAML designer, enhanced WPF support, XAML Hot Reload and integration with .NET MAUI.
Other new features and functionality in the v2.1 update, meanwhile, include:
- Browser Compatibility: OpenSilver apps are compatible with all major browsers, without needing any plugins.
- Newly Ported Silverlight Toolkit Samples: Comprehensive coverage of the Silverlight Toolkit is now in OpenSilver, including additional UI controls and advanced capabilities that can be experienced in the the ported "Silverlight Toolkit Samples" app.
- Enhanced OpenSilver Showcase with 100+ F# Samples: More than 100 samples demonstrate the practical use of F# with XAML in the expanded OpenSilver Showcase.
- Other New Features in OpenSilver 2.1: The new release also includes a complete reimplementation of animations, mirroring Silverlight's capabilities, and improved low-level components, like text display.
The upcoming integration with .NET MAUI, Userware said, will broaden the scope for creating hybrid applications that utilize native platform APIs and simplify application deployments across different platforms.
"We are also committed to enhancing the developer support ecosystem, with new documentation on the way and expanded development support for macOS, VSCode and Rider," the company said. "Additionally, we're reviving the beloved Silverlight PivotViewer control and venturing into support for the development of 3D and Mixed Reality applications (see XR#), opening up a new universe of possibilities for developers."
About the Author
David Ramel is an editor and writer at Converge 360.