-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Breaking Changes
Breaking changes are sometimes unavoidable. We are trying to deprecate API before removing it, but it's not always possible due to either high performance impact of the old design or due to major changes in the corresponding subsystem. The list of API areas where changes are planned and most likely unavoidable can be found here.
Avalonia.ReactiveUI.Events will no longer supports. Use Pharmacist.MSBuild instead. How to use it? For more details, see #5423
-
If your readonly property fields are declared as of type
AvaloniaProperty<T>then you should change them toStyledProperty<>orDirectProperty<,>fields -
The signature for
OnPropertyChangedhas changed and is now a generic method in order to avoid allocation and boxing. To cast theoldValueandnewValueparameters to a concrete type, use.ValueOrDefault<T>()onOptional<T>andBindingValue<T> -
Avalonia properties now take a separate validation and coercion callback the same as WPF. The validation callback cannot be overridden, though the coercion callback can.
-
The
PropertyMetadataclass has now been renamed toAvaloniaPropertyMetadata.
-
Interactive.AddHandlerno longer returns anIDisposable. If you want a disposable you should callAddDisposableHandler: https://github.com/AvaloniaUI/Avalonia/pull/3651
- Many
AvaloniaObject.Bind()overloads have been moved to be extension methods, so you may have to addthis.to yourBind()call when binding to this
The static PseudoClass method was removed: https://github.com/AvaloniaUI/Avalonia/pull/3292
The recommended way to implement pseudoclasses is now like this https://github.com/AvaloniaUI/Avalonia/pull/3292/files#diff-45a4dd48c9a2f83d7def2fd422d1423c
- Removed opacity parameter from
DrawingContext.DrawImage- instead usePushOpacitybefore drawing the image
-
FontSizeis no longer part ofTypeFace- it can now be found onFormattedText -
FormattedText.Wrappingis now calledTextWrapping
Avalonia.Diagnostics is now a separate NuGet package so if you're using AttachDevTools you'll have to add a reference to that.
OnTemplatedApplied has been renamed to on OnApplyTemplate.
DatePicker was renamed to CalendarDatePicker. A DatePicker control has been added.
The LogToDebug method has moved from the Avalonia.Logging.Serilog namesapce to the Avalonia namespace. Remove using Avalonia.Logging.Serilog; to fix.
The preferred way of managing app startup and lifetime is now using lifetimes. You still can use AppMain approach introduced in 0.8 for more fine-grained control, but some of Application.Run/AppBuilder.Start overloads were removed or deprecated.
- x:Class is now mandatory for XAML files with codebehind (windows, user controls,
App.cs, etc) - Class constructors and codebehind event handlers must be public
-
<Style>without selector is no longer valid - Style selectors without type information (e. g.
<Style Selector=".myclass">) are no longer valid, specify the target type using eitherControl.myclassor:is(Control).myclass
Controls are no longer automagically registered in some random name scope that they find in the visual tree. Instead name scopes are now managed manually. If you are using XAML you probably won't notice any breaking changes since our XAML engine manages name registrations automatically, but just setting Name from code will no longer work, you'd have to actually register your controls and pass INameScope instance to bindings.
ItemsControl.MemberSelector has been removed. Instead use a DataTemplate with a binding to the property to be displayed.
The Orientation enum was moved to the Avalonia.Layout namespace.
Has been renamed to VisualLayerManager.
Both BeginResizeDrag and BeginMoveDrag now has an additional PointerPressedEventArg parameter.
DropDown has been renamed to ComboBox. A shim for DropDown is still available for now but deprecated and will be removed in a future release.
FormattedText.Measure has become FormattedText.Bounds.
See https://github.com/AvaloniaUI/Avalonia/pull/2344
The following members now use PixelPosition/PixelRect:
IWindowBaseImpl.PositionIWindowBaseImpl.PositionChangedITopLevelImpl.PointToClientITopLevelImpl.PointToScreenIMouseDevice.PositionScreen.BoundsScreen.WorkingArea
You can use one of the From* static methods and To* instance methods on these structs with a scaling factor to convert between Position and Rect.
See https://github.com/AvaloniaUI/Avalonia/pull/2250
The StringConverter methods have been renamed to add an Is prefix:
-
StringConverters.NullOrEmptybecomesStringConverters.IsNullOrEmpty -
StringConverters.NotNullOrEmptybecomesStringConverters.IsNotNullOrEmpty
See https://github.com/AvaloniaUI/Avalonia/pull/2253
The TreeContainerIndex.Items property have been renamed to Containers.
See https://github.com/AvaloniaUI/Avalonia/pull/2356
Before:
public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder.Configure<App>();
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
builder.UseX11(new X11PlatformOptions() {UseGpu = false});
else if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
builder.UseAvaloniaNative(anopts =>
{
anopts.UseGpu = false;
anopts.MacOptions.ShowInDock = 0;
});
else if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
builder.UseWin32(false, true);
return builder;
}After:
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { UseGpu = false })
.With(new AvaloniaNativePlatformOptions { UseGpu = false })
.With(new MacOSPlatformOptions { ShowInDock = false })
.With(new Win32PlatformOptions { UseDeferredRendering = false });See https://github.com/AvaloniaUI/Avalonia/pull/2368
- Projects that use ReactiveUI framework will need to migrate to Reactive UI 9.0.1 which Avalonia now uses.
- Existing
TemplateBindingswhich specifyPath=will stop working, as thePathproperty was removed and replaced withProperty. Simply remove thePath=qualifier or change it toProperty=if the path was a simple property - Existing
TemplateBindingswhich don't bind to a simple property on the templated parent will need to be changed to regularBindings withRelativeSourceMode.TemplatedParent
See https://github.com/AvaloniaUI/Avalonia/pull/1695
- The Gap property has been renamed to Spacing to be consistent with UWP and other XAML frameworks.
See https://github.com/AvaloniaUI/Avalonia/pull/1786
- BugFix: For the replace operation in the
SelectedItemscollection,AddedItemsandRemovedItemsmembers of theSelectionChangedEventArgsclass had their contents switched.
See https://github.com/AvaloniaUI/Avalonia/pull/1913
Was moved to Application.Windows: https://github.com/AvaloniaUI/Avalonia/pull/1662
- The
DataValidatiorBasebase class has been renamed toDataValidationBase.
See https://github.com/AvaloniaUI/Avalonia/pull/1858
- The
AndroidKeyboardEventsHelper<TView>.ActivateAutoShowKeybordmethod has been renamed toAndroidKeyboardEventsHelper<TView>.ActivateAutoShowKeyboard.
See https://github.com/AvaloniaUI/Avalonia/pull/1859
- The
KeyboardEventsHelper<TView>.ActivateAutoShowKeybordmethod has been renamed toKeyboardEventsHelper<TView>.ActivateAutoShowKeyboard.
See https://github.com/AvaloniaUI/Avalonia/pull/1859
- The
UseGtk3method parameters changed toGtk3PlatformOptions.
See https://github.com/AvaloniaUI/Avalonia/pull/1935
We have removed Avalonia.MonoMac, please use Avalonia.Native instead.
https://github.com/AvaloniaUI/Avalonia/pull/1992/files
We have removed Avalonia.DotNetCoreRuntime, please use Avalonia.DesktopRuntime instead.
- Renamed theme resource from
ThemeBorderLightColortoThemeBorderLowColor. - Renamed theme resource from
ThemeControlLightColortoThemeControlLowColor. - Renamed theme resource from
ThemeForegroundLightColortoThemeForegroundLowColor. - Renamed theme resource from
ErrorLightColortoErrorLowColor. - Renamed theme resource from
ThemeBorderLightBrushtoThemeBorderLowBrush. - Renamed theme resource from
ThemeControlLightBrushtoThemeControlLowBrush. - Renamed theme resource from
ThemeForegroundLightBrushtoThemeForegroundLowBrush. - Renamed theme resource from
ErrorLightBrushtoErrorLowBrush. - Renamed theme resource from
ThemeBorderDarkColortoThemeBorderHighColor. - Renamed theme resource from
ThemeControlDarkColortoThemeControlHighColor. - Renamed theme resource from
ThemeControlHighlightDarkColortoThemeControlHighlightHighColor. - Renamed theme resource from
ThemeBorderDarkBrushtoThemeBorderHighBrush. - Renamed theme resource from
ThemeControlDarkBrushtoThemeControlHighBrush. - Renamed theme resource from
ThemeControlHighlightDarkBrushtoThemeControlHighlightHighBrush.
See https://github.com/AvaloniaUI/Avalonia/pull/2023
Changed both PixelHeight and PixelWidth into a PixelSize struct.
The constructor now requires the size to be provided using PixelSize and also a DPI. Use 96 as a default.
See https://github.com/AvaloniaUI/Avalonia/pull/1889
You now need BuildAvaloniaApp static method in the class with your entry point (typically in Program.cs or App.xaml.cs) which should be called from Main:
static void Main(string[] args)
{
BuildAvaloniaApp().Start<MainWindow>();
}
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToDebug();Previewer won't be able to work without it.
They were replaced by OnDataContextBeginUpdate and OnDataContextEndUpdate
They were replaced by standard x:Static and x:Type, add xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" to the root of your XAML file.
StyleResource has been replaced by StaticResource and DynamicResource as in other XAML frameworks. StaticResource and DynamicResource in Avalonia search both Control.Resources and Style.Resources.
MouseDevice is no longer available from the global context, you need to obtain one from TopLevel (Window, Popup, etc). Call GetVisualRoot() in your control and cast it to IInputRoot.
var pos = (_control.GetVisualRoot() as IInputRoot)?.MouseDevice?.Position ?? default(Point);