From fede3d6138d9be5ef9d2904bd9a6862807497271 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 20 May 2023 15:37:28 +0200 Subject: [PATCH] Fix IsScrollInertiaEnabled warning. Fix the annoying warning: ``` Error in binding to 'Avalonia.Input.GestureRecognizers.ScrollGestureRecognizer'.'IsScrollInertiaEnabled': 'Null value in expression '{empty}' at '$self.TemplatedParent' ``` This is a bit of a hack; we take advantage of the fact that `IsScrollInertiaEnabled` is an attached property and set it on the `ScrollContentPresenter` where the other bound properties are located. Fixes #11148 --- src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml | 5 +++-- src/Avalonia.Themes.Simple/Controls/ScrollViewer.xaml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml b/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml index 1d9815713c..6218fe94ca 100644 --- a/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml @@ -33,11 +33,12 @@ VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}" HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}" VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}" - Padding="{TemplateBinding Padding}"> + Padding="{TemplateBinding Padding}" + ScrollViewer.IsScrollInertiaEnabled="{TemplateBinding IsScrollInertiaEnabled}"> + IsScrollInertiaEnabled="{Binding (ScrollViewer.IsScrollInertiaEnabled), ElementName=PART_ContentPresenter}"/> + Background="{TemplateBinding Background}" + ScrollViewer.IsScrollInertiaEnabled="{TemplateBinding IsScrollInertiaEnabled}"> + IsScrollInertiaEnabled="{Binding (ScrollViewer.IsScrollInertiaEnabled), ElementName=PART_ContentPresenter}"/>