Avalonia 11.1: A Quantum Leap in Cross-Platform UI Development

Here's what's new in the latest version of Avalonia.

...
Steven Kirk

We are thrilled to announce the release of Avalonia 11.1, a massive update to our beloved cross-platform UI framework. While technically a point release, the sheer volume and impact of improvements make it feel more like a major upgrade. This release represents countless hours of hard work from our dedicated team and community contributors, resulting in many new features, performance enhancements, and refinements across the board. Let's dive deep into the most exciting aspects of this release that will empower you to create even more impressive cross-platform applications.

 

Enhanced Cross-Platform Support

Avalonia has always prided itself on supporting the broadest range of platforms, and version 11.1 takes this to new heights:

TV Support: Avalonia 11.1 significantly broadens its reach into the smart TV ecosystem with support for both Samsung Tizen and Apple TV platforms. This expansion opens up exciting new possibilities for developers looking to bring their applications to the big screen. With Samsung Tizen support, you can now target Samsung's smart TVs and other Tizen-based devices, tapping into a growing market segment. Simultaneously, the addition of Apple TV support allows you to create stunning UI experiences within the Apple ecosystem. These new capabilities are particularly exciting for developers aiming to extend their applications into the living room or create unique TV-based experiences.

Browser Improvements: Significant enhancements have been made to Avalonia's browser support. A new software renderer has been implemented, providing better performance and compatibility across browsers. Additionally, the framework now allows multiple AvaloniaView instances, enabling more complex and dynamic web applications. These improvements greatly enhance the flexibility and performance of Avalonia applications running in web browsers, making it a more viable option for web-based projects.

Android and iOS Enhancements: Various improvements have been made to the Android and iOS backends, including fixes for input handling, keyboard interactions, and general stability enhancements. These refinements ensure a smoother experience for both developers and end-users on mobile platforms.

 

Performance Optimizations

Performance is one of our most important features, and Avalonia 11.1 delivers substantial improvements in this area:

Vulkan Backend: A major addition is the new Vulkan rendering backend. This modern, low-overhead graphics API can provide significant performance boosts, especially on platforms that support it natively. Vulkan offers more direct control over the GPU, allowing for better utilization of graphics hardware. It can lead to improved rendering performance and potentially reduced power consumption, which is particularly beneficial for both mobile devices and high-performance desktop applications.

Rendering Optimizations: Numerous optimizations have been made to the rendering pipeline, including improvements to dirty rect handling, transform operations, and general drawing performance. These enhancements result in smoother animations, faster UI updates, and an overall more responsive feel to your applications. The team has put considerable effort into reducing unnecessary redraws and optimizing the rendering process, which should be particularly noticeable in complex UIs with many elements.

Resource Management: Better management of resources, including fonts and XAML resources, should lead to reduced memory usage and faster application startup times. The framework now employs more efficient caching mechanisms and lazy loading strategies, ensuring that resources are loaded only when needed. This not only improves initial load times but also helps in reducing the overall memory footprint of your applications.

 

UI and UX Improvements

Avalonia 11.1 introduces several features that will help developers create more polished and user-friendly interfaces:

HyperlinkButton Control: A new HyperlinkButton control has been added, making it easier to implement clickable links within your UI. This control comes with built-in styling and behaviour appropriate for hyperlinks, saving developers time and ensuring consistency across applications.

Improved Tooltip System: The tooltip system has been overhauled with new features like tooltip chaining and a new BetweenShowDelay property. Tooltip chaining allows for creating more complex information hierarchies, where moving from one element to a related one keeps relevant information visible. The BetweenShowDelay property gives fine-grained control over tooltip timing, allowing for more sophisticated tooltip behaviours.

Enhanced ScrollViewer: Improvements to the ScrollViewer include better handling of scroll snapping with the mouse wheel, providing a smoother scrolling experience. The enhanced ScrollViewer now offers more natural-feeling scrolling that adapts to different input methods, from touchpads to traditional mouse wheels. This results in a more polished feel to your applications, particularly those with long scrollable content.

 

Developer Productivity Features

Avalonia 11.1 includes several features designed to make developers' lives easier and more productive:

Improved DevTools: The built-in developer tools have been enhanced with features like a focus follower and the ability to pin properties. The focus follower allows developers to easily track which element has a focus in real time, which is invaluable for debugging complex input scenarios. The ability to pin properties in the property inspector makes it easier to monitor specific values as you interact with your application.

XAML Improvements: The XAML system has seen numerous improvements, including better handling of generics, more efficient compiled bindings, and enhanced diagnostics for XAML-related issues. The improved generics support allows for more flexible and reusable component definitions. Compiled bindings now generate more optimized code, resulting in better runtime performance. The enhanced diagnostics provide clearer error messages and warnings, helping developers catch and fix issues earlier in the development cycle.

Enhanced Binding System: The data binding system has been refined, with improvements to MultiBinding, better handling of ICommand bindings in style setters, and more reactive PropertyChanged events. MultiBinding now handles null values more gracefully and provides better performance. The improvements to ICommand bindings in style setters make it easier to create interactive UI elements in a more declarative manner. The more reactive PropertyChanged events ensure that your UI stays in sync with your data model more reliably.

New Converter Types: The introduction of FuncValueConverter with parameter support provides more flexibility in data conversion scenarios. This new converter type allows for more concise and readable binding expressions, especially for simple conversions that don't warrant a full converter class. It's particularly useful for quick prototyping or for simple, one-off conversions.

For example, Avalonia now has ObjectConverters.Equal which is implemented as so:  

Code Snippet

 

Graphics and Animation Enhancements

Graphics capabilities have been expanded in this release.

New Pixel Formats: Support for Rgb32 and Bgr32 pixel formats has been added, providing more options for image handling and manipulation. These new formats allow for more efficient processing of certain types of images and can lead to performance improvements in image-heavy applications. They also provide better compatibility with certain external imaging libraries and file formats.

Improved Brush Handling: Enhancements to TileBrush and DrawingBrush provide more powerful and flexible options for creating complex graphical effects. TileBrush now offers better control over tiling behaviour, including improved handling of edge cases. DrawingBrush has been optimized for performance and now supports more complex drawing operations. These improvements allow for the creation of more sophisticated visual effects with less code and better performance.

Animation Refinements: The animation system has seen improvements, including fixes to the Animator class for handling progress values less than zero. This ensures smoother and more predictable animations, especially for complex sequences or when dealing with dynamically changing values. Additionally, the overall performance of animations has been improved, allowing for more complex animations without impacting application responsiveness.

 

Accessibility and Internationalization

Avalonia continues to improve its support for creating accessible applications:

Improved Screen Reader Support: Various controls, including the DataGrid, have received enhancements to their automation properties, improving screen reader compatibility. This includes better labelling, more descriptive state changes, and improved navigation support. These enhancements make it easier for developers to create applications that are usable by people with visual impairments without requiring extensive additional coding.

Better Input Method Editor (IME) Support: Improvements have been made to IME handling, particularly benefiting users of languages that require complex input methods. This includes better handling of composition events, improved cursor positioning, and more reliable text insertion. These enhancements make Avalonia applications more usable for users of languages such as Chinese, Japanese, and Korean.

Enhanced Localization Support: New APIs have been added to make it easier to localize built-in controls and messages. This includes improving the resource system for managing localized strings and better support for right-to-left languages. These features simplify the creation of applications that can reach a global audience.

 

Mobile-Specific Enhancements

Recognizing the growing importance of mobile development, Avalonia 11.1 includes several mobile-specific improvements:

Text Selection Handles: Implementation of text selection handles for touch input in TextBox controls, providing a more native feel on mobile devices. This feature mimics the behaviour users expect on mobile platforms, making text selection and editing more intuitive and user-friendly.

Safe Area Handling: Improved handling of safe areas on mobile devices ensures that your UI adapts correctly to different device form factors and orientations. This is particularly important for devices with notches or rounded corners, ensuring that your UI content is always visible and not obscured by device features.

Mobile Gesture Recognition: Enhancements to gesture recognition, particularly for touch devices, provide a more responsive and intuitive user experience on mobile platforms. This includes improvements to pinch-to-zoom, swipe gestures, and multi-touch interactions. These enhancements allow developers to create more natural-feeling mobile interfaces without having to implement custom gesture recognizers.

 

New Windowing Features

Several improvements have been made to window management, enhancing the flexibility and control developers have over their application's presentation:

Multi-Monitor DPI Scaling: Better handling of DPI scaling across multiple monitors ensures that your application looks crisp and correctly sized on all displays. This is particularly important in today's diverse computing environments where users often have multiple displays with different scaling factors. Avalonia now handles these scenarios more gracefully, ensuring a consistent look across all screens.

Window Z-Order API: A new API for fetching window Z-order gives developers more control over window stacking and management. This is particularly useful for applications that manage multiple windows or create custom window management behaviours. It allows for more sophisticated MDI-style interfaces or custom window management solutions.

Improved Window Sizing and Positioning: Various enhancements to window sizing, positioning, and state management provide more reliable and consistent behaviour across platforms. This includes better handling of maximized and minimized states, more accurate initial positioning, and improved resizing behaviour. These improvements ensure that your application behaves predictably across different operating systems and window managers.

 

File System Integration

Avalonia 11.1 improves its integration with native file systems, making it easier to create applications that work seamlessly with the host operating system:

Enhanced File Dialogs: The file picker dialogs have been improved, with better support for file type filtering and initial directory selection. These enhancements make it easier to create intuitive file selection experiences that align with platform expectations. The improved filtering options allow for more granular control over the types of files users can select.

File Activation Support: New APIs for handling file activation events make it easier to implement file association features in your applications. This allows your Avalonia applications to respond when a user opens a file from the operating system, providing a more integrated experience. It's particularly useful for document-centric applications or tools that work with specific file types.

 

Build and Deployment Improvements

Several changes have been made to improve the build and deployment process, making it easier to create and distribute Avalonia applications:

NativeAOT Support: Improved support for NativeAOT compilation ensures that Avalonia applications can take full advantage of this performance-enhancing technology. NativeAOT allows for faster startup times and reduced memory usage by compiling your application to native code ahead of time. This is particularly beneficial for desktop applications where startup performance is crucial.

Simplified Resource Handling: Changes to how assembly resources are handled should result in smaller application sizes and faster load times. The resource system has been optimized to reduce duplication and improve loading efficiency. This can lead to significant size reductions in larger applications with many embedded resources.

Enhanced XAML Compilation: Improvements to the XAML compilation process provide better performance and more reliable error reporting. The compiler now generates more optimized code and provides clearer error messages when issues are detected. This can help catch problems earlier in the development process and result in better runtime performance.

These build and deployment enhancements should result in smaller, faster applications.

 

Conclusion

Avalonia 11.1 represents a significant step forward for the framework. The breadth and depth of improvements demonstrate our team's commitment to providing a top-tier cross-platform UI development experience. From expanded platform support and performance optimizations to enhanced developer tools and improved accessibility, this release touches on virtually every aspect of the framework.

We encourage all Avalonia developers to upgrade to this new version and explore the wealth of new features and improvements it offers. Your feedback and contributions are invaluable in shaping the future of Avalonia, so please don't hesitate to share your experiences and suggestions with the community.

We want to extend our heartfelt thanks to all the contributors, both from the core team and the community, who have made this release possible. Your hard work, creativity, and dedication are what make Avalonia such a powerful and loved framework.

Happy developing, and we can't wait to see the amazing applications you'll create with Avalonia 11.1!

Latest Posts

Here’s what you might have missed.