Browse Source

add IsScrollInertiaEnabled setter and getter

pull/10289/head
Emmanuel Hansen 3 years ago
parent
commit
87709b9606
  1. 16
      src/Avalonia.Controls/ScrollViewer.cs
  2. 2
      src/Avalonia.Themes.Fluent/Controls/ListBox.xaml

16
src/Avalonia.Controls/ScrollViewer.cs

@ -775,6 +775,22 @@ namespace Avalonia.Controls
control.SetValue(VerticalScrollBarVisibilityProperty, value);
}
/// <summary>
/// Gets whether scroll gestures should include inertia in their behavior and value.
/// </summary>
public static bool GetIsScrollInertiaEnabled(Control control)
{
return control.GetValue(IsScrollInertiaEnabledProperty);
}
/// <summary>
/// Sets whether scroll gestures should include inertia in their behavior and value.
/// </summary>
public static void SetIsScrollInertiaEnabled(Control control, bool value)
{
control.SetValue(IsScrollInertiaEnabledProperty, value);
}
/// <inheritdoc/>
public void RegisterAnchorCandidate(Control element)
{

2
src/Avalonia.Themes.Fluent/Controls/ListBox.xaml

@ -19,6 +19,7 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="ScrollViewer.IsScrollInertiaEnabled" Value="True" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<ControlTemplate>
@ -34,6 +35,7 @@
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
IsScrollInertiaEnabled="{TemplateBinding (ScrollViewer.IsScrollInertiaEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<ItemsPresenter Name="PART_ItemsPresenter"
AreVerticalSnapPointsRegular="{TemplateBinding AreVerticalSnapPointsRegular}"

Loading…
Cancel
Save