Browse Source

Merge branch 'master' into windows-position

pull/7450/head
Nathan Garside 5 years ago
committed by GitHub
parent
commit
9c4722e409
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/Avalonia.Controls.DataGrid/DataGrid.cs
  2. 197
      src/Avalonia.Controls/Button.cs
  3. 34
      src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
  4. 52
      src/Avalonia.Controls/ScrollViewer.cs
  5. 2
      src/Avalonia.OpenGL/Egl/EglContext.cs
  6. 2
      src/Avalonia.Themes.Default/Controls/ListBox.xaml
  7. 3
      src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml
  8. 2
      src/Avalonia.Themes.Default/Controls/TextBox.xaml
  9. 2
      src/Avalonia.Themes.Default/Controls/TreeView.xaml
  10. 2
      src/Avalonia.Themes.Fluent/Controls/ListBox.xaml
  11. 3
      src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml
  12. 2
      src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
  13. 2
      src/Avalonia.Themes.Fluent/Controls/TreeView.xaml

9
src/Avalonia.Controls.DataGrid/DataGrid.cs

@ -2215,7 +2215,14 @@ namespace Avalonia.Controls
/// <param name="e">PointerWheelEventArgs</param> /// <param name="e">PointerWheelEventArgs</param>
protected override void OnPointerWheelChanged(PointerWheelEventArgs e) protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
{ {
e.Handled = e.Handled || UpdateScroll(e.Delta * DATAGRID_mouseWheelDelta); if(UpdateScroll(e.Delta * DATAGRID_mouseWheelDelta))
{
e.Handled = true;
}
else
{
e.Handled = e.Handled || !ScrollViewer.GetIsScrollChainingEnabled(this);
}
} }
internal bool UpdateScroll(Vector delta) internal bool UpdateScroll(Vector delta)

197
src/Avalonia.Controls/Button.cs

@ -59,13 +59,13 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<Button, object>(nameof(CommandParameter)); AvaloniaProperty.Register<Button, object>(nameof(CommandParameter));
/// <summary> /// <summary>
/// Defines the <see cref="IsDefaultProperty"/> property. /// Defines the <see cref="IsDefault"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<bool> IsDefaultProperty = public static readonly StyledProperty<bool> IsDefaultProperty =
AvaloniaProperty.Register<Button, bool>(nameof(IsDefault)); AvaloniaProperty.Register<Button, bool>(nameof(IsDefault));
/// <summary> /// <summary>
/// Defines the <see cref="IsCancelProperty"/> property. /// Defines the <see cref="IsCancel"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<bool> IsCancelProperty = public static readonly StyledProperty<bool> IsCancelProperty =
AvaloniaProperty.Register<Button, bool>(nameof(IsCancel)); AvaloniaProperty.Register<Button, bool>(nameof(IsCancel));
@ -76,6 +76,9 @@ namespace Avalonia.Controls
public static readonly RoutedEvent<RoutedEventArgs> ClickEvent = public static readonly RoutedEvent<RoutedEventArgs> ClickEvent =
RoutedEvent.Register<Button, RoutedEventArgs>(nameof(Click), RoutingStrategies.Bubble); RoutedEvent.Register<Button, RoutedEventArgs>(nameof(Click), RoutingStrategies.Bubble);
/// <summary>
/// Defines the <see cref="IsPressed"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsPressedProperty = public static readonly StyledProperty<bool> IsPressedProperty =
AvaloniaProperty.Register<Button, bool>(nameof(IsPressed)); AvaloniaProperty.Register<Button, bool>(nameof(IsPressed));
@ -95,13 +98,12 @@ namespace Avalonia.Controls
static Button() static Button()
{ {
FocusableProperty.OverrideDefaultValue(typeof(Button), true); FocusableProperty.OverrideDefaultValue(typeof(Button), true);
CommandProperty.Changed.Subscribe(CommandChanged);
CommandParameterProperty.Changed.Subscribe(CommandParameterChanged);
IsDefaultProperty.Changed.Subscribe(IsDefaultChanged);
IsCancelProperty.Changed.Subscribe(IsCancelChanged);
AccessKeyHandler.AccessKeyPressedEvent.AddClassHandler<Button>((lbl, args) => lbl.OnAccessKey(args)); AccessKeyHandler.AccessKeyPressedEvent.AddClassHandler<Button>((lbl, args) => lbl.OnAccessKey(args));
} }
/// <summary>
/// Initializes a new instance of the <see cref="Button"/> class.
/// </summary>
public Button() public Button()
{ {
UpdatePseudoClasses(IsPressed); UpdatePseudoClasses(IsPressed);
@ -112,8 +114,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public event EventHandler<RoutedEventArgs> Click public event EventHandler<RoutedEventArgs> Click
{ {
add { AddHandler(ClickEvent, value); } add => AddHandler(ClickEvent, value);
remove { RemoveHandler(ClickEvent, value); } remove => RemoveHandler(ClickEvent, value);
} }
/// <summary> /// <summary>
@ -121,8 +123,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public ClickMode ClickMode public ClickMode ClickMode
{ {
get { return GetValue(ClickModeProperty); } get => GetValue(ClickModeProperty);
set { SetValue(ClickModeProperty, value); } set => SetValue(ClickModeProperty, value);
} }
/// <summary> /// <summary>
@ -130,8 +132,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public ICommand Command public ICommand Command
{ {
get { return _command; } get => _command;
set { SetAndRaise(CommandProperty, ref _command, value); } set => SetAndRaise(CommandProperty, ref _command, value);
} }
/// <summary> /// <summary>
@ -139,8 +141,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public KeyGesture HotKey public KeyGesture HotKey
{ {
get { return GetValue(HotKeyProperty); } get => GetValue(HotKeyProperty);
set { SetValue(HotKeyProperty, value); } set => SetValue(HotKeyProperty, value);
} }
/// <summary> /// <summary>
@ -148,8 +150,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public object CommandParameter public object CommandParameter
{ {
get { return GetValue(CommandParameterProperty); } get => GetValue(CommandParameterProperty);
set { SetValue(CommandParameterProperty, value); } set => SetValue(CommandParameterProperty, value);
} }
/// <summary> /// <summary>
@ -158,8 +160,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public bool IsDefault public bool IsDefault
{ {
get { return GetValue(IsDefaultProperty); } get => GetValue(IsDefaultProperty);
set { SetValue(IsDefaultProperty, value); } set => SetValue(IsDefaultProperty, value);
} }
/// <summary> /// <summary>
@ -168,18 +170,21 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public bool IsCancel public bool IsCancel
{ {
get { return GetValue(IsCancelProperty); } get => GetValue(IsCancelProperty);
set { SetValue(IsCancelProperty, value); } set => SetValue(IsCancelProperty, value);
} }
/// <summary>
/// Gets or sets a value indicating whether the button is currently pressed.
/// </summary>
public bool IsPressed public bool IsPressed
{ {
get { return GetValue(IsPressedProperty); } get => GetValue(IsPressedProperty);
private set { SetValue(IsPressedProperty, value); } private set => SetValue(IsPressedProperty, value);
} }
/// <summary> /// <summary>
/// Gets or sets the Flyout that should be shown with this button /// Gets or sets the Flyout that should be shown with this button.
/// </summary> /// </summary>
public FlyoutBase Flyout public FlyoutBase Flyout
{ {
@ -187,7 +192,8 @@ namespace Avalonia.Controls
set => SetValue(FlyoutProperty, value); set => SetValue(FlyoutProperty, value);
} }
protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute; /// <inheritdoc/>
protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute;
/// <inheritdoc/> /// <inheritdoc/>
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
@ -224,6 +230,7 @@ namespace Avalonia.Controls
} }
} }
/// <inheritdoc/>
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{ {
if (_hotkey != null) // Control attached again, set Hotkey to create a hotkey manager for this control if (_hotkey != null) // Control attached again, set Hotkey to create a hotkey manager for this control
@ -240,6 +247,7 @@ namespace Avalonia.Controls
} }
} }
/// <inheritdoc/>
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{ {
// This will cause the hotkey manager to dispose the observer and the reference to this control // This will cause the hotkey manager to dispose the observer and the reference to this control
@ -358,12 +366,14 @@ namespace Avalonia.Controls
} }
} }
} }
/// <inheritdoc/>
protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
{ {
IsPressed = false; IsPressed = false;
} }
/// <inheritdoc/>
protected override void OnLostFocus(RoutedEventArgs e) protected override void OnLostFocus(RoutedEventArgs e)
{ {
base.OnLostFocus(e); base.OnLostFocus(e);
@ -371,119 +381,93 @@ namespace Avalonia.Controls
IsPressed = false; IsPressed = false;
} }
/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change) protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
{ {
base.OnPropertyChanged(change); base.OnPropertyChanged(change);
if (change.Property == IsPressedProperty) if (change.Property == CommandProperty)
{
UpdatePseudoClasses(change.NewValue.GetValueOrDefault<bool>());
}
else if (change.Property == FlyoutProperty)
{ {
// If flyout is changed while one is already open, make sure we if (((ILogical)this).IsAttachedToLogicalTree)
// close the old one first
if (change.OldValue.GetValueOrDefault() is FlyoutBase oldFlyout &&
oldFlyout.IsOpen)
{ {
oldFlyout.Hide(); if (change.OldValue.GetValueOrDefault() is ICommand oldCommand)
{
oldCommand.CanExecuteChanged -= CanExecuteChanged;
}
if (change.NewValue.GetValueOrDefault() is ICommand newCommand)
{
newCommand.CanExecuteChanged += CanExecuteChanged;
}
} }
}
}
protected override void UpdateDataValidation<T>(AvaloniaProperty<T> property, BindingValue<T> value) CanExecuteChanged(this, EventArgs.Empty);
{ }
base.UpdateDataValidation(property, value); else if (change.Property == CommandParameterProperty)
if (property == CommandProperty)
{ {
if (value.Type == BindingValueType.BindingError) CanExecuteChanged(this, EventArgs.Empty);
}
else if (change.Property == IsCancelProperty)
{
var isCancel = change.NewValue.GetValueOrDefault<bool>();
if (VisualRoot is IInputElement inputRoot)
{ {
if (_commandCanExecute) if (isCancel)
{ {
_commandCanExecute = false; ListenForCancel(inputRoot);
UpdateIsEffectivelyEnabled(); }
else
{
StopListeningForCancel(inputRoot);
} }
} }
} }
} else if (change.Property == IsDefaultProperty)
/// <summary>
/// Called when the <see cref="Command"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private static void CommandChanged(AvaloniaPropertyChangedEventArgs e)
{
if (e.Sender is Button button)
{ {
if (((ILogical)button).IsAttachedToLogicalTree) var isDefault = change.NewValue.GetValueOrDefault<bool>();
if (VisualRoot is IInputElement inputRoot)
{ {
if (e.OldValue is ICommand oldCommand) if (isDefault)
{ {
oldCommand.CanExecuteChanged -= button.CanExecuteChanged; ListenForDefault(inputRoot);
} }
else
if (e.NewValue is ICommand newCommand)
{ {
newCommand.CanExecuteChanged += button.CanExecuteChanged; StopListeningForDefault(inputRoot);
} }
} }
button.CanExecuteChanged(button, EventArgs.Empty);
} }
} else if (change.Property == IsPressedProperty)
/// <summary>
/// Called when the <see cref="CommandParameter"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private static void CommandParameterChanged(AvaloniaPropertyChangedEventArgs e)
{
if (e.Sender is Button button)
{ {
button.CanExecuteChanged(button, EventArgs.Empty); UpdatePseudoClasses(change.NewValue.GetValueOrDefault<bool>());
} }
} else if (change.Property == FlyoutProperty)
/// <summary>
/// Called when the <see cref="IsDefault"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private static void IsDefaultChanged(AvaloniaPropertyChangedEventArgs e)
{
var button = e.Sender as Button;
var isDefault = (bool)e.NewValue;
if (button?.VisualRoot is IInputElement inputRoot)
{ {
if (isDefault) // If flyout is changed while one is already open, make sure we
{ // close the old one first
button.ListenForDefault(inputRoot); if (change.OldValue.GetValueOrDefault() is FlyoutBase oldFlyout &&
} oldFlyout.IsOpen)
else
{ {
button.StopListeningForDefault(inputRoot); oldFlyout.Hide();
} }
} }
} }
/// <summary> /// <inheritdoc/>
/// Called when the <see cref="IsCancel"/> property changes. protected override void UpdateDataValidation<T>(AvaloniaProperty<T> property, BindingValue<T> value)
/// </summary>
/// <param name="e">The event args.</param>
private static void IsCancelChanged(AvaloniaPropertyChangedEventArgs e)
{ {
var button = e.Sender as Button; base.UpdateDataValidation(property, value);
var isCancel = (bool)e.NewValue; if (property == CommandProperty)
if (button?.VisualRoot is IInputElement inputRoot)
{ {
if (isCancel) if (value.Type == BindingValueType.BindingError)
{
button.ListenForCancel(inputRoot);
}
else
{ {
button.StopListeningForCancel(inputRoot); if (_commandCanExecute)
{
_commandCanExecute = false;
UpdateIsEffectivelyEnabled();
}
} }
} }
} }
@ -566,6 +550,9 @@ namespace Avalonia.Controls
} }
} }
/// <summary>
/// Updates the visual state of the control by applying latest PseudoClasses.
/// </summary>
private void UpdatePseudoClasses(bool isPressed) private void UpdatePseudoClasses(bool isPressed)
{ {
PseudoClasses.Set(":pressed", isPressed); PseudoClasses.Set(":pressed", isPressed);

34
src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs

@ -60,6 +60,12 @@ namespace Avalonia.Controls.Presenters
o => o.Viewport, o => o.Viewport,
(o, v) => o.Viewport = v); (o, v) => o.Viewport = v);
/// <summary>
/// Defines the <see cref="IsScrollChainingEnabled"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsScrollChainingEnabledProperty =
ScrollViewer.IsScrollChainingEnabledProperty.AddOwner<ScrollContentPresenter>();
private bool _canHorizontallyScroll; private bool _canHorizontallyScroll;
private bool _canVerticallyScroll; private bool _canVerticallyScroll;
private bool _arranging; private bool _arranging;
@ -138,6 +144,20 @@ namespace Avalonia.Controls.Presenters
private set { SetAndRaise(ViewportProperty, ref _viewport, value); } private set { SetAndRaise(ViewportProperty, ref _viewport, value); }
} }
/// <summary>
/// Gets or sets if scroll chaining is enabled. The default value is true.
/// </summary>
/// <remarks>
/// After a user hits a scroll limit on an element that has been nested within another scrollable element,
/// you can specify whether that parent element should continue the scrolling operation begun in its child element.
/// This is called scroll chaining.
/// </remarks>
public bool IsScrollChainingEnabled
{
get => GetValue(IsScrollChainingEnabledProperty);
set => SetValue(IsScrollChainingEnabledProperty, value);
}
/// <inheritdoc/> /// <inheritdoc/>
IControl? IScrollAnchorProvider.CurrentAnchor IControl? IScrollAnchorProvider.CurrentAnchor
{ {
@ -405,8 +425,11 @@ namespace Avalonia.Controls.Presenters
_activeLogicalGestureScrolls[e.Id] = delta; _activeLogicalGestureScrolls[e.Id] = delta;
} }
Offset = new Vector(x, y); Vector newOffset = new Vector(x, y);
e.Handled = true; bool offsetChanged = newOffset != Offset;
Offset = newOffset;
e.Handled = !IsScrollChainingEnabled || offsetChanged;
} }
} }
@ -440,8 +463,11 @@ namespace Avalonia.Controls.Presenters
x = Math.Min(x, Extent.Width - Viewport.Width); x = Math.Min(x, Extent.Width - Viewport.Width);
} }
Offset = new Vector(x, y); Vector newOffset = new Vector(x, y);
e.Handled = true; bool offsetChanged = newOffset != Offset;
Offset = newOffset;
e.Handled = !IsScrollChainingEnabled || offsetChanged;
} }
} }

52
src/Avalonia.Controls/ScrollViewer.cs

@ -181,6 +181,14 @@ namespace Avalonia.Controls
nameof(AllowAutoHide), nameof(AllowAutoHide),
true); true);
/// <summary>
/// Defines the <see cref="IsScrollChainingEnabled"/> property.
/// </summary>
public static readonly AttachedProperty<bool> IsScrollChainingEnabledProperty =
AvaloniaProperty.RegisterAttached<ScrollViewer, Control, bool>(
nameof(IsScrollChainingEnabled),
defaultValue: true);
/// <summary> /// <summary>
/// Defines the <see cref="ScrollChanged"/> event. /// Defines the <see cref="ScrollChanged"/> event.
/// </summary> /// </summary>
@ -418,6 +426,20 @@ namespace Avalonia.Controls
set => SetValue(AllowAutoHideProperty, value); set => SetValue(AllowAutoHideProperty, value);
} }
/// <summary>
/// Gets or sets if scroll chaining is enabled. The default value is true.
/// </summary>
/// <remarks>
/// After a user hits a scroll limit on an element that has been nested within another scrollable element,
/// you can specify whether that parent element should continue the scrolling operation begun in its child element.
/// This is called scroll chaining.
/// </remarks>
public bool IsScrollChainingEnabled
{
get => GetValue(IsScrollChainingEnabledProperty);
set => SetValue(IsScrollChainingEnabledProperty, value);
}
/// <summary> /// <summary>
/// Scrolls the content up one line. /// Scrolls the content up one line.
/// </summary> /// </summary>
@ -548,6 +570,36 @@ namespace Avalonia.Controls
return control.GetValue(AllowAutoHideProperty); return control.GetValue(AllowAutoHideProperty);
} }
/// <summary>
/// Sets the value of the IsScrollChainingEnabled attached property.
/// </summary>
/// <param name="control">The control to set the value on.</param>
/// <param name="value">The value of the property.</param>
/// <remarks>
/// After a user hits a scroll limit on an element that has been nested within another scrollable element,
/// you can specify whether that parent element should continue the scrolling operation begun in its child element.
/// This is called scroll chaining.
/// </remarks>
public static void SetIsScrollChainingEnabled(Control control, bool value)
{
control.SetValue(IsScrollChainingEnabledProperty, value);
}
/// <summary>
/// Gets the value of the IsScrollChainingEnabled attached property.
/// </summary>
/// <param name="control">The control to read the value from.</param>
/// <returns>The value of the property.</returns>
/// <remarks>
/// After a user hits a scroll limit on an element that has been nested within another scrollable element,
/// you can specify whether that parent element should continue the scrolling operation begun in its child element.
/// This is called scroll chaining.
/// </remarks>
public static bool GetIsScrollChainingEnabled(Control control)
{
return control.GetValue(IsScrollChainingEnabledProperty);
}
/// <summary> /// <summary>
/// Gets the value of the VerticalScrollBarVisibility attached property. /// Gets the value of the VerticalScrollBarVisibility attached property.
/// </summary> /// </summary>

2
src/Avalonia.OpenGL/Egl/EglContext.cs

@ -82,7 +82,7 @@ namespace Avalonia.OpenGL.Egl
finally finally
{ {
if(!success) if(!success)
Monitor.Enter(_lock); Monitor.Exit(_lock);
} }
} }

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

@ -6,6 +6,7 @@
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="border" BorderBrush="{TemplateBinding BorderBrush}" <Border Name="border" BorderBrush="{TemplateBinding BorderBrush}"
@ -15,6 +16,7 @@
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"

3
src/Avalonia.Themes.Default/Controls/ScrollViewer.xaml

@ -15,7 +15,8 @@
Extent="{TemplateBinding Extent, Mode=TwoWay}" Extent="{TemplateBinding Extent, Mode=TwoWay}"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
Offset="{TemplateBinding Offset, Mode=TwoWay}" Offset="{TemplateBinding Offset, Mode=TwoWay}"
Viewport="{TemplateBinding Viewport, Mode=TwoWay}"> Viewport="{TemplateBinding Viewport, Mode=TwoWay}"
IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}">
<ScrollContentPresenter.GestureRecognizers> <ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer <ScrollGestureRecognizer
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}" CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"

2
src/Avalonia.Themes.Default/Controls/TextBox.xaml

@ -25,6 +25,7 @@
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}"/> <Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}"/>
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4"/>
<Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" /> <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="border" <Border Name="border"
@ -59,6 +60,7 @@
<ScrollViewer Grid.Column="1" Grid.ColumnSpan="1" <ScrollViewer Grid.Column="1" Grid.ColumnSpan="1"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<Panel> <Panel>
<TextBlock Name="watermark" <TextBlock Name="watermark"

2
src/Avalonia.Themes.Default/Controls/TreeView.xaml

@ -5,6 +5,7 @@
<Setter Property="Padding" Value="4"/> <Setter Property="Padding" Value="4"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border BorderBrush="{TemplateBinding BorderBrush}" <Border BorderBrush="{TemplateBinding BorderBrush}"
@ -13,6 +14,7 @@
<ScrollViewer Background="{TemplateBinding Background}" <ScrollViewer Background="{TemplateBinding Background}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"

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

@ -16,6 +16,7 @@
<Setter Property="BorderThickness" Value="{DynamicResource ListBoxBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
@ -28,6 +29,7 @@
<ScrollViewer Name="PART_ScrollViewer" <ScrollViewer Name="PART_ScrollViewer"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"

3
src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml

@ -34,7 +34,8 @@
Extent="{TemplateBinding Extent, Mode=TwoWay}" Extent="{TemplateBinding Extent, Mode=TwoWay}"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
Offset="{TemplateBinding Offset, Mode=TwoWay}" Offset="{TemplateBinding Offset, Mode=TwoWay}"
Viewport="{TemplateBinding Viewport, Mode=TwoWay}"> Viewport="{TemplateBinding Viewport, Mode=TwoWay}"
IsScrollChainingEnabled="{TemplateBinding IsScrollChainingEnabled}">
<ScrollContentPresenter.GestureRecognizers> <ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer <ScrollGestureRecognizer
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}" CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"

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

@ -41,6 +41,7 @@
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" /> <Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" /> <Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
<Setter Property="FocusAdorner" Value="{x:Null}" /> <Setter Property="FocusAdorner" Value="{x:Null}" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" /> <Setter Property="ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
@ -68,6 +69,7 @@
DockPanel.Dock="Top" /> DockPanel.Dock="Top" />
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<Panel> <Panel>
<TextBlock Name="PART_Watermark" <TextBlock Name="PART_Watermark"

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

@ -6,6 +6,7 @@
<Setter Property="Padding" Value="0" /> <Setter Property="Padding" Value="0" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border BorderBrush="{TemplateBinding BorderBrush}" <Border BorderBrush="{TemplateBinding BorderBrush}"
@ -14,6 +15,7 @@
<ScrollViewer Background="{TemplateBinding Background}" <ScrollViewer Background="{TemplateBinding Background}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}" Items="{TemplateBinding Items}"

Loading…
Cancel
Save