Browse Source
Merge pull request #7585 from AvaloniaUI/improove-nullable-annotations-getcontrolindirection
Improve nullable annotations for ILogicalScrollable.GetControlInDirection
pull/7622/head
Tako
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
8 additions and
8 deletions
-
src/Avalonia.Controls/DateTimePickers/DateTimePickerPanel.cs
-
src/Avalonia.Controls/Generators/IItemContainerGenerator.cs
-
src/Avalonia.Controls/Generators/ItemContainerGenerator.cs
-
src/Avalonia.Controls/Presenters/ItemVirtualizer.cs
-
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
-
src/Avalonia.Controls/Presenters/ItemsPresenter.cs
-
src/Avalonia.Controls/Primitives/ILogicalScrollable.cs
-
src/Avalonia.Controls/VirtualizingStackPanel.cs
|
|
|
@ -560,7 +560,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
public bool BringIntoView(IControl target, Rect targetRect) { return false; } |
|
|
|
|
|
|
|
public IControl? GetControlInDirection(NavigationDirection direction, IControl from) { return null; } |
|
|
|
public IControl? GetControlInDirection(NavigationDirection direction, IControl? from) { return null; } |
|
|
|
|
|
|
|
public void RaiseScrollInvalidated(EventArgs e) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -97,6 +97,6 @@ namespace Avalonia.Controls.Generators |
|
|
|
/// </summary>
|
|
|
|
/// <param name="container">The container.</param>
|
|
|
|
/// <returns>The index of the container, or -1 if not found.</returns>
|
|
|
|
int IndexFromContainer(IControl container); |
|
|
|
int IndexFromContainer(IControl? container); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -158,7 +158,7 @@ namespace Avalonia.Controls.Generators |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public int IndexFromContainer(IControl container) |
|
|
|
public int IndexFromContainer(IControl? container) |
|
|
|
{ |
|
|
|
foreach (var i in _containers) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -254,7 +254,7 @@ namespace Avalonia.Controls.Presenters |
|
|
|
/// <param name="direction">The movement direction.</param>
|
|
|
|
/// <param name="from">The control from which movement begins.</param>
|
|
|
|
/// <returns>The control.</returns>
|
|
|
|
public virtual IControl? GetControlInDirection(NavigationDirection direction, IControl from) |
|
|
|
public virtual IControl? GetControlInDirection(NavigationDirection direction, IControl? from) |
|
|
|
{ |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@ -226,7 +226,7 @@ namespace Avalonia.Controls.Presenters |
|
|
|
InvalidateScroll(); |
|
|
|
} |
|
|
|
|
|
|
|
public override IControl? GetControlInDirection(NavigationDirection direction, IControl from) |
|
|
|
public override IControl? GetControlInDirection(NavigationDirection direction, IControl? from) |
|
|
|
{ |
|
|
|
var generator = Owner.ItemContainerGenerator; |
|
|
|
var panel = VirtualizingPanel; |
|
|
|
|
|
|
|
@ -117,7 +117,7 @@ namespace Avalonia.Controls.Presenters |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
IControl? ILogicalScrollable.GetControlInDirection(NavigationDirection direction, IControl from) |
|
|
|
IControl? ILogicalScrollable.GetControlInDirection(NavigationDirection direction, IControl? from) |
|
|
|
{ |
|
|
|
return Virtualizer?.GetControlInDirection(direction, from); |
|
|
|
} |
|
|
|
|
|
|
|
@ -64,7 +64,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
/// <param name="direction">The movement direction.</param>
|
|
|
|
/// <param name="from">The control from which movement begins.</param>
|
|
|
|
/// <returns>The control.</returns>
|
|
|
|
IControl? GetControlInDirection(NavigationDirection direction, IControl from); |
|
|
|
IControl? GetControlInDirection(NavigationDirection direction, IControl? from); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Raises the <see cref="ScrollInvalidated"/> event.
|
|
|
|
|
|
|
|
@ -133,7 +133,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (logicalScrollable?.IsLogicalScrollEnabled == true) |
|
|
|
{ |
|
|
|
return logicalScrollable.GetControlInDirection(direction, from!); |
|
|
|
return logicalScrollable.GetControlInDirection(direction, from); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|