Avalonia 0.10.0 Release
- Published
- 2020-12-29
- Author
- Steven Kirk
- Category
- Release
We are pleased to announce that Avalonia 0.10.0 has been released.
0.10 is a huge update, it has been extensively tested and brings some great new features and improvements.
Fluent Theme
The most noticable change for Avalonia 0.10 is a beautiful new Fluent theme. Now your Avalonia applications will look better than ever:
The fluent theme is available in light and dark modes, and will be used by the 0.10 templates by default. It can be enabled in existing applications by including the following in your App.axaml
:
<Application.Styles>
<FluentTheme Mode="Light"/>
</Application.Styles>
Where Mode
can be Light
or Dark
.
New Controls
Along with the fluent theme, several new controls have been added:
DatePicker/TimePicker
The DatePicker
and TimePicker
controls give you a standardized way to let users pick a localized date or time value value using touch, mouse, or keyboard input.
<DatePicker Header="Date of birth"/>
ToggleSwitch
ToggleSwitch
is a control that can be toggled between 2 states.
<ToggleSwitch OffContent="Power Off" OnContent="Power On"/>
Label
The Label
control allows a text label with a shortcut key to be assocated with a control such as a TextBox
such that pressing Alt plus the shortcut key will focus the associated control:
<StackPanel>
<!-- Pressing Alt+N will focus nameTextBox -->
<Label Target="nameTextBox">_Name</Label>
<TextBox Name="nameTextBox">
</StackPanel>
The shortcut key is designated by prepending an underscore to the desired character in the Label
content, N
in this example.
Related PRs:
Compiled Bindings
Avalonia 0.10 includes experimental support for compiled bindings. When using compiled bindings, binding paths are verified at compile time and do not use reflection at runtime.
To enable compiled bindings, add an x:DataType
attribute to your root control and use the {CompiledBinding}
markup extension or set x:CompileBindings="True"
.
<Window xmlns="https://github.com/avaloniaui"
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
x:Class="AvaloniaApplication"
xmlns:vm="using:AvaloniaApplication.ViewModels"
x:DataType="vm:MainWindowViewModel">
<!-- The existence of the MyValue property will be checked at compile-time -->
<TextBox Text="{CompiledBinding MyValue}"/>
</Window>
Related PRs:
Unicode Support
Avalonia's TextBlock
now correctly supports unicode characters.
Full Unicode support for TextBox
will be incoming in the near future.
Related PRs:
Box Shadows
Box shadows can now be applied to Border
controls:
<Border BoxShadow="4 4 4 gray"
Background="Silver"
Margin="20"
Padding="10">
<TextBlock>Box Shadow</TextBlock>
</Border>
Related PRs:
DevTools Improvements
DevTools has been completely revamped for the 0.10 release.
The new features include:
- A built-in console using roslyn scripting which allows running arbitrary code
- Editing of property values
- Improved display and grouping of control properties
- Filtering control properties using a string or regular expression
- A visualization of a control's layout properties such as width, height, margins and padding:
- Toggle an FPS overlay and dirty rect visualization for the window from DevTools from the "Options" menu
Related PRs:
- https://github.com/AvaloniaUI/Avalonia/pull/3462
- https://github.com/AvaloniaUI/Avalonia/pull/4523
- https://github.com/AvaloniaUI/Avalonia/pull/4529
- https://github.com/AvaloniaUI/Avalonia/pull/4609
Typed Property Change Notifications
The OnPropertyChanged
method and AvaloniaProperty<T>.Changed
observable APIs have been changed to use a typed AvaloniaPropertyChangedEventArgs<T>
class to prevent boxing. Note that this is a breaking change.
Related PRs:
SelectionModel
Selection on SelectingItemsControl
-derived controls such as ListBox
and ComboBox
now implement their selection tracking via a SelectionModel
which gives the following improvements:
- Selection ranges are now stored as a range of indexes, so selecting all items in a large list of for example 100,000 elements is now stored simply as a range of
0-99999
. Previously each selected item was added to a list, inflating memory usage - Selection now handles duplicate items
- The selection model can be bound to a view model allowing fine control of the selected items at the view model layer
Related PRs:
Breaking Changes
See our wiki for a list of breaking changes in this release.
Getting started
Follow instructions here.
Support and Contributing
The best way to support Avalonia is to get involved, implement a feature, fix a bug or help test. See contributing for information on how to get started.
For commercial users, AvaloniaUI OÜ provides support packages and custom development services. Contact us at team@avaloniaui.net for more information.
Otherwise you can sponsor Avalonia financially via OpenCollective.
We hope you enjoy developing with Avalonia - please let us know what you are building!