News

OpenSilver 3.2 Takes WPF Apps to Mobile with .NET MAUI Hybrid Integration

OpenSilver, an open-source, WebAssembly-based reimplementation of the deprecated Microsoft Silverlight, now supports .NET MAUI Hybrid for cross-platform web and native app development.

The project, from French company Userware, is designed to enable modern web development using C#, XAML, and .NET technologies to create rich internet applications (RIAs). It was created to fill a gap created by the 2021 deprecation of Microsoft Silverlight, which relied on a browser plugin for execution. Silverlight was enthusiastically supported by many developers who decried its deprecation.

The project has been incrementally improved over the years, and the brand-new OpenSilver 3.2 release comes with several enhancements, not the least of which is the mobile aspect.

"Until now, OpenSilver has focused on bringing WPF and Silverlight applications to modern web browsers," said a March 18 announcement. "With version 3.2, we're expanding this reach to mobile and desktop app stores through integration with .NET MAUI Hybrid. This approach combines the consistency of web-based UI rendering with the power of native .NET runtime."

.NET MAUI is the evolution of old Xamarin-based tech that had a mobile focus. The successor to Xamarin.Forms added the ability to also create desktop apps in .NET MAUI Hybrid, a cross-platform UI framework that enables developers to build applications using Blazor and WebView, allowing web-based UIs to run as native apps on Windows, macOS, iOS, and Android while sharing .NET code across platforms.

OpenSilver 3.2 leverages .NET MAUI Hybrid integration to deliver a WPF-compatible UI through WebView while compiling C# business logic to native code, allowing direct access to device APIs. Userware said this approach:

  • Maintains a single XAML/C# codebase across platforms
  • Provides access to native device APIs through MAUI
  • Enables app store distribution
  • Preserves a consistent UI across all platforms

Existing OpenSilver applications can easily add mobile support by adding a MAUI Hybrid project to their solution.

OpenSilver 3.2 Project Wizard
[Click on image for larger view.] OpenSilver 3.2 Project Wizard (source: Userware).

This approach facilitates a practical migration path for existing WPF applications, preserving developers' skills and code investments while enabling deployment to native app marketplaces.

Other highlights of the release include:

  • Enhanced WPF compatibility:
    • Right-to-left support: Full support for languages that read from right to left, improving internationalization
    • WPF-like event bubbling: Improved event routing that more closely matches WPF behavior
    • Advanced animations: Better support for complex, WPF-style animations
    • VirtualizingStackPanel improvements: Enhanced performance for displaying large collections of data
    • Mobile scroll inertia: Smoother, more natural-feeling scrolling on touch devices
  • Improved tooling support:
    • Visual Studio and VS Code extensions: Now available in official marketplaces for easier installation
    • XAML designer for VS Code: First-ever drag-and-drop XAML designer for VS Code
    • AI-assisted XAML design: Intelligent features to aid in XAML development
    • Comprehensive project templates: Ready-made templates for web, MAUI Hybrid, and desktop projects
  • EventManager implementation:
    • Register new routed events: Ability to create custom routed events
    • Register class handlers: Support for class-level event handling
  • Flow direction improvements:
    • Layout mirroring: Automatic UI mirroring for right-to-left languages
    • Mixed direction support: Handling of both left-to-right and right-to-left content in the same UI
  • Animation enhancements:
    • Multiple targets for Storyboards: Animate multiple objects simultaneously
    • UIElement animations without Storyboard: Simpler animation setup for individual elements
  • Scrolling improvements:
    • Panning support: Touch-friendly panning for scrollable content
    • Scroll inertia: Physics-based scrolling for a more natural feel
    • VirtualizingStackPanel enhancements: Better performance and smoother scrolling for large data sets
  • Other improvements:
    • New FrameworkPropertyMetadata options: More control over data binding and property behavior
    • Visibility.Hidden implementation: Support for hiding elements without affecting layout
    • New Popup placement modes: More flexible positioning options for popup windows
    • MouseDoubleClick event: Native support for double-click interactions

At the time of this writing, those new tools for the Visual Studio IDE and the Visual Studio Code editor have been installed 10 times and 894 times, respectively.

The Visual Studio tool's description reads: "Project templates and XAML Designer for creating OpenSilver applications. OpenSilver is a modern cross-platform reimplementation of WPF and Silverlight that enables .NET developers to build apps for web (WebAssembly), mobile and desktop (MAUI Hybrid) using C# and XAML."

The VS Code description reads: "Adds a drag-and-drop XAML designer and commands to simplify building OpenSilver apps. OpenSilver is an open-source .NET UI framework that brings WPF and Silverlight to the web via HTML and WebAssembly."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

Subscribe on YouTube