Browse Source

Nullability tweaks in lower-level libraries.

pull/7476/head
Steven Kirk 5 years ago
parent
commit
ad0a813304
  1. 2
      src/Avalonia.Input/ICloseable.cs
  2. 22
      src/Avalonia.Input/IInputElement.cs
  3. 2
      src/Avalonia.Input/IMainMenu.cs
  4. 2
      src/Avalonia.Input/INavigableContainer.cs
  5. 32
      src/Avalonia.Input/InputElement.cs
  6. 10
      src/Avalonia.Input/TextInput/ITextInputMethodClient.cs
  7. 2
      src/Avalonia.Input/TextInput/ITextInputMethodImpl.cs
  8. 11
      src/Avalonia.Interactivity/Interactive.cs
  9. 2
      src/Avalonia.Layout/ElementManager.cs
  10. 2
      src/Avalonia.Layout/FlowLayoutAlgorithm.cs
  11. 8
      src/Avalonia.Layout/LayoutHelper.cs
  12. 2
      src/Avalonia.Layout/StackLayout.cs
  13. 2
      src/Avalonia.Layout/UniformGridLayout.cs
  14. 4
      src/Avalonia.Layout/VirtualizingLayout.cs
  15. 2
      src/Avalonia.Layout/WrapLayout/WrapLayout.cs
  16. 2
      src/Avalonia.Styling/Controls/IResourceHost.cs
  17. 2
      src/Avalonia.Styling/Controls/IResourceProvider.cs
  18. 4
      src/Avalonia.Styling/LogicalTree/LogicalTreeAttachmentEventArgs.cs
  19. 4
      src/Avalonia.Styling/Styling/IGlobalStyles.cs
  20. 4
      src/Avalonia.Visuals/Media/DrawingContext.cs
  21. 4
      src/Avalonia.Visuals/Platform/LockedFramebuffer.cs
  22. 2
      src/Avalonia.Visuals/VisualTree/IHostedVisualTreeRoot.cs
  23. 2
      src/Avalonia.Visuals/VisualTree/IVisualTreeHost.cs

2
src/Avalonia.Input/ICloseable.cs

@ -4,6 +4,6 @@ namespace Avalonia.Input
{ {
public interface ICloseable public interface ICloseable
{ {
event EventHandler Closed; event EventHandler? Closed;
} }
} }

22
src/Avalonia.Input/IInputElement.cs

@ -15,57 +15,57 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the control receives focus. /// Occurs when the control receives focus.
/// </summary> /// </summary>
event EventHandler<GotFocusEventArgs> GotFocus; event EventHandler<GotFocusEventArgs>? GotFocus;
/// <summary> /// <summary>
/// Occurs when the control loses focus. /// Occurs when the control loses focus.
/// </summary> /// </summary>
event EventHandler<RoutedEventArgs> LostFocus; event EventHandler<RoutedEventArgs>? LostFocus;
/// <summary> /// <summary>
/// Occurs when a key is pressed while the control has focus. /// Occurs when a key is pressed while the control has focus.
/// </summary> /// </summary>
event EventHandler<KeyEventArgs> KeyDown; event EventHandler<KeyEventArgs>? KeyDown;
/// <summary> /// <summary>
/// Occurs when a key is released while the control has focus. /// Occurs when a key is released while the control has focus.
/// </summary> /// </summary>
event EventHandler<KeyEventArgs> KeyUp; event EventHandler<KeyEventArgs>? KeyUp;
/// <summary> /// <summary>
/// Occurs when a user typed some text while the control has focus. /// Occurs when a user typed some text while the control has focus.
/// </summary> /// </summary>
event EventHandler<TextInputEventArgs> TextInput; event EventHandler<TextInputEventArgs>? TextInput;
/// <summary> /// <summary>
/// Occurs when the pointer enters the control. /// Occurs when the pointer enters the control.
/// </summary> /// </summary>
event EventHandler<PointerEventArgs> PointerEnter; event EventHandler<PointerEventArgs>? PointerEnter;
/// <summary> /// <summary>
/// Occurs when the pointer leaves the control. /// Occurs when the pointer leaves the control.
/// </summary> /// </summary>
event EventHandler<PointerEventArgs> PointerLeave; event EventHandler<PointerEventArgs>? PointerLeave;
/// <summary> /// <summary>
/// Occurs when the pointer is pressed over the control. /// Occurs when the pointer is pressed over the control.
/// </summary> /// </summary>
event EventHandler<PointerPressedEventArgs> PointerPressed; event EventHandler<PointerPressedEventArgs>? PointerPressed;
/// <summary> /// <summary>
/// Occurs when the pointer moves over the control. /// Occurs when the pointer moves over the control.
/// </summary> /// </summary>
event EventHandler<PointerEventArgs> PointerMoved; event EventHandler<PointerEventArgs>? PointerMoved;
/// <summary> /// <summary>
/// Occurs when the pointer is released over the control. /// Occurs when the pointer is released over the control.
/// </summary> /// </summary>
event EventHandler<PointerReleasedEventArgs> PointerReleased; event EventHandler<PointerReleasedEventArgs>? PointerReleased;
/// <summary> /// <summary>
/// Occurs when the mouse wheel is scrolled over the control. /// Occurs when the mouse wheel is scrolled over the control.
/// </summary> /// </summary>
event EventHandler<PointerWheelEventArgs> PointerWheelChanged; event EventHandler<PointerWheelEventArgs>? PointerWheelChanged;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the control can receive keyboard focus. /// Gets or sets a value indicating whether the control can receive keyboard focus.

2
src/Avalonia.Input/IMainMenu.cs

@ -27,6 +27,6 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the main menu closes. /// Occurs when the main menu closes.
/// </summary> /// </summary>
event EventHandler<RoutedEventArgs> MenuClosed; event EventHandler<RoutedEventArgs>? MenuClosed;
} }
} }

2
src/Avalonia.Input/INavigableContainer.cs

@ -12,6 +12,6 @@ namespace Avalonia.Input
/// <param name="from">The control from which movement begins.</param> /// <param name="from">The control from which movement begins.</param>
/// <param name="wrap">Whether to wrap around when the first or last item is reached.</param> /// <param name="wrap">Whether to wrap around when the first or last item is reached.</param>
/// <returns>The control.</returns> /// <returns>The control.</returns>
IInputElement GetControl(NavigationDirection direction, IInputElement from, bool wrap); IInputElement? GetControl(NavigationDirection direction, IInputElement? from, bool wrap);
} }
} }

32
src/Avalonia.Input/InputElement.cs

@ -233,7 +233,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the control receives focus. /// Occurs when the control receives focus.
/// </summary> /// </summary>
public event EventHandler<GotFocusEventArgs> GotFocus public event EventHandler<GotFocusEventArgs>? GotFocus
{ {
add { AddHandler(GotFocusEvent, value); } add { AddHandler(GotFocusEvent, value); }
remove { RemoveHandler(GotFocusEvent, value); } remove { RemoveHandler(GotFocusEvent, value); }
@ -242,7 +242,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the control loses focus. /// Occurs when the control loses focus.
/// </summary> /// </summary>
public event EventHandler<RoutedEventArgs> LostFocus public event EventHandler<RoutedEventArgs>? LostFocus
{ {
add { AddHandler(LostFocusEvent, value); } add { AddHandler(LostFocusEvent, value); }
remove { RemoveHandler(LostFocusEvent, value); } remove { RemoveHandler(LostFocusEvent, value); }
@ -251,7 +251,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when a key is pressed while the control has focus. /// Occurs when a key is pressed while the control has focus.
/// </summary> /// </summary>
public event EventHandler<KeyEventArgs> KeyDown public event EventHandler<KeyEventArgs>? KeyDown
{ {
add { AddHandler(KeyDownEvent, value); } add { AddHandler(KeyDownEvent, value); }
remove { RemoveHandler(KeyDownEvent, value); } remove { RemoveHandler(KeyDownEvent, value); }
@ -260,7 +260,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when a key is released while the control has focus. /// Occurs when a key is released while the control has focus.
/// </summary> /// </summary>
public event EventHandler<KeyEventArgs> KeyUp public event EventHandler<KeyEventArgs>? KeyUp
{ {
add { AddHandler(KeyUpEvent, value); } add { AddHandler(KeyUpEvent, value); }
remove { RemoveHandler(KeyUpEvent, value); } remove { RemoveHandler(KeyUpEvent, value); }
@ -269,7 +269,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when a user typed some text while the control has focus. /// Occurs when a user typed some text while the control has focus.
/// </summary> /// </summary>
public event EventHandler<TextInputEventArgs> TextInput public event EventHandler<TextInputEventArgs>? TextInput
{ {
add { AddHandler(TextInputEvent, value); } add { AddHandler(TextInputEvent, value); }
remove { RemoveHandler(TextInputEvent, value); } remove { RemoveHandler(TextInputEvent, value); }
@ -278,7 +278,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when an input element gains input focus and input method is looking for the corresponding client /// Occurs when an input element gains input focus and input method is looking for the corresponding client
/// </summary> /// </summary>
public event EventHandler<TextInputMethodClientRequestedEventArgs> TextInputMethodClientRequested public event EventHandler<TextInputMethodClientRequestedEventArgs>? TextInputMethodClientRequested
{ {
add { AddHandler(TextInputMethodClientRequestedEvent, value); } add { AddHandler(TextInputMethodClientRequestedEvent, value); }
remove { RemoveHandler(TextInputMethodClientRequestedEvent, value); } remove { RemoveHandler(TextInputMethodClientRequestedEvent, value); }
@ -287,7 +287,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when an input element gains input focus and input method is asking for required content options /// Occurs when an input element gains input focus and input method is asking for required content options
/// </summary> /// </summary>
public event EventHandler<TextInputOptionsQueryEventArgs> TextInputOptionsQuery public event EventHandler<TextInputOptionsQueryEventArgs>? TextInputOptionsQuery
{ {
add { AddHandler(TextInputOptionsQueryEvent, value); } add { AddHandler(TextInputOptionsQueryEvent, value); }
remove { RemoveHandler(TextInputOptionsQueryEvent, value); } remove { RemoveHandler(TextInputOptionsQueryEvent, value); }
@ -296,7 +296,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the pointer enters the control. /// Occurs when the pointer enters the control.
/// </summary> /// </summary>
public event EventHandler<PointerEventArgs> PointerEnter public event EventHandler<PointerEventArgs>? PointerEnter
{ {
add { AddHandler(PointerEnterEvent, value); } add { AddHandler(PointerEnterEvent, value); }
remove { RemoveHandler(PointerEnterEvent, value); } remove { RemoveHandler(PointerEnterEvent, value); }
@ -305,7 +305,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the pointer leaves the control. /// Occurs when the pointer leaves the control.
/// </summary> /// </summary>
public event EventHandler<PointerEventArgs> PointerLeave public event EventHandler<PointerEventArgs>? PointerLeave
{ {
add { AddHandler(PointerLeaveEvent, value); } add { AddHandler(PointerLeaveEvent, value); }
remove { RemoveHandler(PointerLeaveEvent, value); } remove { RemoveHandler(PointerLeaveEvent, value); }
@ -314,7 +314,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the pointer moves over the control. /// Occurs when the pointer moves over the control.
/// </summary> /// </summary>
public event EventHandler<PointerEventArgs> PointerMoved public event EventHandler<PointerEventArgs>? PointerMoved
{ {
add { AddHandler(PointerMovedEvent, value); } add { AddHandler(PointerMovedEvent, value); }
remove { RemoveHandler(PointerMovedEvent, value); } remove { RemoveHandler(PointerMovedEvent, value); }
@ -323,7 +323,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the pointer is pressed over the control. /// Occurs when the pointer is pressed over the control.
/// </summary> /// </summary>
public event EventHandler<PointerPressedEventArgs> PointerPressed public event EventHandler<PointerPressedEventArgs>? PointerPressed
{ {
add { AddHandler(PointerPressedEvent, value); } add { AddHandler(PointerPressedEvent, value); }
remove { RemoveHandler(PointerPressedEvent, value); } remove { RemoveHandler(PointerPressedEvent, value); }
@ -332,7 +332,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the pointer is released over the control. /// Occurs when the pointer is released over the control.
/// </summary> /// </summary>
public event EventHandler<PointerReleasedEventArgs> PointerReleased public event EventHandler<PointerReleasedEventArgs>? PointerReleased
{ {
add { AddHandler(PointerReleasedEvent, value); } add { AddHandler(PointerReleasedEvent, value); }
remove { RemoveHandler(PointerReleasedEvent, value); } remove { RemoveHandler(PointerReleasedEvent, value); }
@ -342,7 +342,7 @@ namespace Avalonia.Input
/// Occurs when the control or its child control loses the pointer capture for any reason, /// Occurs when the control or its child control loses the pointer capture for any reason,
/// event will not be triggered for a parent control if capture was transferred to another child of that parent control /// event will not be triggered for a parent control if capture was transferred to another child of that parent control
/// </summary> /// </summary>
public event EventHandler<PointerCaptureLostEventArgs> PointerCaptureLost public event EventHandler<PointerCaptureLostEventArgs>? PointerCaptureLost
{ {
add => AddHandler(PointerCaptureLostEvent, value); add => AddHandler(PointerCaptureLostEvent, value);
remove => RemoveHandler(PointerCaptureLostEvent, value); remove => RemoveHandler(PointerCaptureLostEvent, value);
@ -351,7 +351,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when the mouse is scrolled over the control. /// Occurs when the mouse is scrolled over the control.
/// </summary> /// </summary>
public event EventHandler<PointerWheelEventArgs> PointerWheelChanged public event EventHandler<PointerWheelEventArgs>? PointerWheelChanged
{ {
add { AddHandler(PointerWheelChangedEvent, value); } add { AddHandler(PointerWheelChangedEvent, value); }
remove { RemoveHandler(PointerWheelChangedEvent, value); } remove { RemoveHandler(PointerWheelChangedEvent, value); }
@ -360,7 +360,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when a tap gesture occurs on the control. /// Occurs when a tap gesture occurs on the control.
/// </summary> /// </summary>
public event EventHandler<TappedEventArgs> Tapped public event EventHandler<TappedEventArgs>? Tapped
{ {
add { AddHandler(TappedEvent, value); } add { AddHandler(TappedEvent, value); }
remove { RemoveHandler(TappedEvent, value); } remove { RemoveHandler(TappedEvent, value); }
@ -369,7 +369,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Occurs when a double-tap gesture occurs on the control. /// Occurs when a double-tap gesture occurs on the control.
/// </summary> /// </summary>
public event EventHandler<TappedEventArgs> DoubleTapped public event EventHandler<TappedEventArgs>? DoubleTapped
{ {
add { AddHandler(DoubleTappedEvent, value); } add { AddHandler(DoubleTappedEvent, value); }
remove { RemoveHandler(DoubleTappedEvent, value); } remove { RemoveHandler(DoubleTappedEvent, value); }

10
src/Avalonia.Input/TextInput/ITextInputMethodClient.cs

@ -12,7 +12,7 @@ namespace Avalonia.Input.TextInput
/// <summary> /// <summary>
/// Should be fired when cursor rectangle is changed inside the TextViewVisual /// Should be fired when cursor rectangle is changed inside the TextViewVisual
/// </summary> /// </summary>
event EventHandler CursorRectangleChanged; event EventHandler? CursorRectangleChanged;
/// <summary> /// <summary>
/// The visual that's showing the text /// The visual that's showing the text
/// </summary> /// </summary>
@ -20,7 +20,7 @@ namespace Avalonia.Input.TextInput
/// <summary> /// <summary>
/// Should be fired when text-hosting visual is changed /// Should be fired when text-hosting visual is changed
/// </summary> /// </summary>
event EventHandler TextViewVisualChanged; event EventHandler? TextViewVisualChanged;
/// <summary> /// <summary>
/// Indicates if TextViewVisual is capable of displaying non-committed input on the cursor position /// Indicates if TextViewVisual is capable of displaying non-committed input on the cursor position
/// </summary> /// </summary>
@ -40,15 +40,15 @@ namespace Avalonia.Input.TextInput
/// <summary> /// <summary>
/// Should be fired when surrounding text changed /// Should be fired when surrounding text changed
/// </summary> /// </summary>
event EventHandler SurroundingTextChanged; event EventHandler? SurroundingTextChanged;
/// <summary> /// <summary>
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the beginning of the text entry /// Returns the text before the cursor. Must return a non-empty string if cursor is not at the beginning of the text entry
/// </summary> /// </summary>
string TextBeforeCursor { get; } string? TextBeforeCursor { get; }
/// <summary> /// <summary>
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the end of the text entry /// Returns the text before the cursor. Must return a non-empty string if cursor is not at the end of the text entry
/// </summary> /// </summary>
string TextAfterCursor { get; } string? TextAfterCursor { get; }
} }
public struct TextInputMethodSurroundingText public struct TextInputMethodSurroundingText

2
src/Avalonia.Input/TextInput/ITextInputMethodImpl.cs

@ -10,6 +10,6 @@ namespace Avalonia.Input.TextInput
public interface ITextInputMethodRoot : IInputRoot public interface ITextInputMethodRoot : IInputRoot
{ {
ITextInputMethodImpl InputMethod { get; } ITextInputMethodImpl? InputMethod { get; }
} }
} }

11
src/Avalonia.Interactivity/Interactive.cs

@ -50,12 +50,14 @@ namespace Avalonia.Interactivity
/// <param name="handledEventsToo">Whether handled events should also be listened for.</param> /// <param name="handledEventsToo">Whether handled events should also be listened for.</param>
public void AddHandler<TEventArgs>( public void AddHandler<TEventArgs>(
RoutedEvent<TEventArgs> routedEvent, RoutedEvent<TEventArgs> routedEvent,
EventHandler<TEventArgs> handler, EventHandler<TEventArgs>? handler,
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble,
bool handledEventsToo = false) where TEventArgs : RoutedEventArgs bool handledEventsToo = false) where TEventArgs : RoutedEventArgs
{ {
routedEvent = routedEvent ?? throw new ArgumentNullException(nameof(routedEvent)); routedEvent = routedEvent ?? throw new ArgumentNullException(nameof(routedEvent));
handler = handler ?? throw new ArgumentNullException(nameof(handler));
if (handler is null)
return;
static void InvokeAdapter(Delegate baseHandler, object sender, RoutedEventArgs args) static void InvokeAdapter(Delegate baseHandler, object sender, RoutedEventArgs args)
{ {
@ -99,10 +101,11 @@ namespace Avalonia.Interactivity
/// <typeparam name="TEventArgs">The type of the event's args.</typeparam> /// <typeparam name="TEventArgs">The type of the event's args.</typeparam>
/// <param name="routedEvent">The routed event.</param> /// <param name="routedEvent">The routed event.</param>
/// <param name="handler">The handler.</param> /// <param name="handler">The handler.</param>
public void RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs> routedEvent, EventHandler<TEventArgs> handler) public void RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs> routedEvent, EventHandler<TEventArgs>? handler)
where TEventArgs : RoutedEventArgs where TEventArgs : RoutedEventArgs
{ {
RemoveHandler(routedEvent, (Delegate)handler); if (handler is not null)
RemoveHandler(routedEvent, (Delegate)handler);
} }
/// <summary> /// <summary>

2
src/Avalonia.Layout/ElementManager.cs

@ -263,7 +263,7 @@ namespace Avalonia.Layout
return intersects; return intersects;
} }
public void DataSourceChanged(object source, NotifyCollectionChangedEventArgs args) public void DataSourceChanged(object? source, NotifyCollectionChangedEventArgs args)
{ {
if (_realizedElements.Count > 0) if (_realizedElements.Count > 0)
{ {

2
src/Avalonia.Layout/FlowLayoutAlgorithm.cs

@ -135,7 +135,7 @@ namespace Avalonia.Layout
} }
public void OnItemsSourceChanged( public void OnItemsSourceChanged(
object source, object? source,
NotifyCollectionChangedEventArgs args, NotifyCollectionChangedEventArgs args,
VirtualizingLayoutContext context) VirtualizingLayoutContext context)
{ {

8
src/Avalonia.Layout/LayoutHelper.cs

@ -33,13 +33,13 @@ namespace Avalonia.Layout
MathUtilities.Clamp(constraints.Height, minmax.MinHeight, minmax.MaxHeight)); MathUtilities.Clamp(constraints.Height, minmax.MinHeight, minmax.MaxHeight));
} }
public static Size MeasureChild(ILayoutable control, Size availableSize, Thickness padding, public static Size MeasureChild(ILayoutable? control, Size availableSize, Thickness padding,
Thickness borderThickness) Thickness borderThickness)
{ {
return MeasureChild(control, availableSize, padding + borderThickness); return MeasureChild(control, availableSize, padding + borderThickness);
} }
public static Size MeasureChild(ILayoutable control, Size availableSize, Thickness padding) public static Size MeasureChild(ILayoutable? control, Size availableSize, Thickness padding)
{ {
if (control != null) if (control != null)
{ {
@ -50,12 +50,12 @@ namespace Avalonia.Layout
return new Size(padding.Left + padding.Right, padding.Bottom + padding.Top); return new Size(padding.Left + padding.Right, padding.Bottom + padding.Top);
} }
public static Size ArrangeChild(ILayoutable child, Size availableSize, Thickness padding, Thickness borderThickness) public static Size ArrangeChild(ILayoutable? child, Size availableSize, Thickness padding, Thickness borderThickness)
{ {
return ArrangeChild(child, availableSize, padding + borderThickness); return ArrangeChild(child, availableSize, padding + borderThickness);
} }
public static Size ArrangeChild(ILayoutable child, Size availableSize, Thickness padding) public static Size ArrangeChild(ILayoutable? child, Size availableSize, Thickness padding)
{ {
child?.Arrange(new Rect(availableSize).Deflate(padding)); child?.Arrange(new Rect(availableSize).Deflate(padding));

2
src/Avalonia.Layout/StackLayout.cs

@ -313,7 +313,7 @@ namespace Avalonia.Layout
return new Size(value.Width, value.Height); return new Size(value.Width, value.Height);
} }
protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object source, NotifyCollectionChangedEventArgs args) protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object? source, NotifyCollectionChangedEventArgs args)
{ {
GetFlowAlgorithm(context).OnItemsSourceChanged(source, args, context); GetFlowAlgorithm(context).OnItemsSourceChanged(source, args, context);
// Always invalidate layout to keep the view accurate. // Always invalidate layout to keep the view accurate.

2
src/Avalonia.Layout/UniformGridLayout.cs

@ -461,7 +461,7 @@ namespace Avalonia.Layout
return new Size(value.Width, value.Height); return new Size(value.Width, value.Height);
} }
protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object source, NotifyCollectionChangedEventArgs args) protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object? source, NotifyCollectionChangedEventArgs args)
{ {
GetFlowAlgorithm(context).OnItemsSourceChanged(source, args, context); GetFlowAlgorithm(context).OnItemsSourceChanged(source, args, context);
// Always invalidate layout to keep the view accurate. // Always invalidate layout to keep the view accurate.

4
src/Avalonia.Layout/VirtualizingLayout.cs

@ -35,7 +35,7 @@ namespace Avalonia.Layout
/// </remarks> /// </remarks>
public void OnItemsChanged( public void OnItemsChanged(
VirtualizingLayoutContext context, VirtualizingLayoutContext context,
object source, object? source,
NotifyCollectionChangedEventArgs args) => OnItemsChangedCore(context, source, args); NotifyCollectionChangedEventArgs args) => OnItemsChangedCore(context, source, args);
/// <summary> /// <summary>
@ -113,7 +113,7 @@ namespace Avalonia.Layout
/// <param name="args">Data about the collection change.</param> /// <param name="args">Data about the collection change.</param>
protected internal virtual void OnItemsChangedCore( protected internal virtual void OnItemsChangedCore(
VirtualizingLayoutContext context, VirtualizingLayoutContext context,
object source, object? source,
NotifyCollectionChangedEventArgs args) => InvalidateMeasure(); NotifyCollectionChangedEventArgs args) => InvalidateMeasure();
} }
} }

2
src/Avalonia.Layout/WrapLayout/WrapLayout.cs

@ -86,7 +86,7 @@ namespace Avalonia.Layout
} }
/// <inheritdoc /> /// <inheritdoc />
protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object source, NotifyCollectionChangedEventArgs args) protected internal override void OnItemsChangedCore(VirtualizingLayoutContext context, object? source, NotifyCollectionChangedEventArgs args)
{ {
var state = (WrapLayoutState)context.LayoutState!; var state = (WrapLayoutState)context.LayoutState!;

2
src/Avalonia.Styling/Controls/IResourceHost.cs

@ -15,7 +15,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Raised when the resources change on the element or an ancestor of the element. /// Raised when the resources change on the element or an ancestor of the element.
/// </summary> /// </summary>
event EventHandler<ResourcesChangedEventArgs> ResourcesChanged; event EventHandler<ResourcesChangedEventArgs>? ResourcesChanged;
/// <summary> /// <summary>
/// Notifies the resource host that one or more of its hosted resources has changed. /// Notifies the resource host that one or more of its hosted resources has changed.

2
src/Avalonia.Styling/Controls/IResourceProvider.cs

@ -25,7 +25,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Raised when the <see cref="Owner"/> of the resource provider changes. /// Raised when the <see cref="Owner"/> of the resource provider changes.
/// </summary> /// </summary>
event EventHandler OwnerChanged; event EventHandler? OwnerChanged;
/// <summary> /// <summary>
/// Adds an owner to the resource provider. /// Adds an owner to the resource provider.

4
src/Avalonia.Styling/LogicalTree/LogicalTreeAttachmentEventArgs.cs

@ -17,7 +17,7 @@ namespace Avalonia.LogicalTree
public LogicalTreeAttachmentEventArgs( public LogicalTreeAttachmentEventArgs(
ILogicalRoot root, ILogicalRoot root,
ILogical source, ILogical source,
ILogical parent) ILogical? parent)
{ {
Root = root ?? throw new ArgumentNullException(nameof(root)); Root = root ?? throw new ArgumentNullException(nameof(root));
Source = source ?? throw new ArgumentNullException(nameof(source)); Source = source ?? throw new ArgumentNullException(nameof(source));
@ -47,6 +47,6 @@ namespace Avalonia.LogicalTree
/// detachment, holds the old logical parent of <see cref="Source"/>. If the detachment event /// detachment, holds the old logical parent of <see cref="Source"/>. If the detachment event
/// was caused by a top-level control being closed, then this property will be null. /// was caused by a top-level control being closed, then this property will be null.
/// </remarks> /// </remarks>
public ILogical Parent { get; } public ILogical? Parent { get; }
} }
} }

4
src/Avalonia.Styling/Styling/IGlobalStyles.cs

@ -13,11 +13,11 @@ namespace Avalonia.Styling
/// <summary> /// <summary>
/// Raised when styles are added to <see cref="Styles"/> or a nested styles collection. /// Raised when styles are added to <see cref="Styles"/> or a nested styles collection.
/// </summary> /// </summary>
public event Action<IReadOnlyList<IStyle>> GlobalStylesAdded; public event Action<IReadOnlyList<IStyle>>? GlobalStylesAdded;
/// <summary> /// <summary>
/// Raised when styles are removed from <see cref="Styles"/> or a nested styles collection. /// Raised when styles are removed from <see cref="Styles"/> or a nested styles collection.
/// </summary> /// </summary>
public event Action<IReadOnlyList<IStyle>> GlobalStylesRemoved; public event Action<IReadOnlyList<IStyle>>? GlobalStylesRemoved;
} }
} }

4
src/Avalonia.Visuals/Media/DrawingContext.cs

@ -119,7 +119,7 @@ namespace Avalonia.Media
/// <param name="brush">The fill brush.</param> /// <param name="brush">The fill brush.</param>
/// <param name="pen">The stroke pen.</param> /// <param name="pen">The stroke pen.</param>
/// <param name="geometry">The geometry.</param> /// <param name="geometry">The geometry.</param>
public void DrawGeometry(IBrush brush, IPen pen, Geometry geometry) public void DrawGeometry(IBrush? brush, IPen? pen, Geometry geometry)
{ {
if (geometry.PlatformImpl is not null) if (geometry.PlatformImpl is not null)
DrawGeometry(brush, pen, geometry.PlatformImpl); DrawGeometry(brush, pen, geometry.PlatformImpl);
@ -131,7 +131,7 @@ namespace Avalonia.Media
/// <param name="brush">The fill brush.</param> /// <param name="brush">The fill brush.</param>
/// <param name="pen">The stroke pen.</param> /// <param name="pen">The stroke pen.</param>
/// <param name="geometry">The geometry.</param> /// <param name="geometry">The geometry.</param>
public void DrawGeometry(IBrush brush, IPen pen, IGeometryImpl geometry) public void DrawGeometry(IBrush? brush, IPen? pen, IGeometryImpl geometry)
{ {
_ = geometry ?? throw new ArgumentNullException(nameof(geometry)); _ = geometry ?? throw new ArgumentNullException(nameof(geometry));

4
src/Avalonia.Visuals/Platform/LockedFramebuffer.cs

@ -4,10 +4,10 @@ namespace Avalonia.Platform
{ {
public class LockedFramebuffer : ILockedFramebuffer public class LockedFramebuffer : ILockedFramebuffer
{ {
private readonly Action _onDispose; private readonly Action? _onDispose;
public LockedFramebuffer(IntPtr address, PixelSize size, int rowBytes, Vector dpi, PixelFormat format, public LockedFramebuffer(IntPtr address, PixelSize size, int rowBytes, Vector dpi, PixelFormat format,
Action onDispose) Action? onDispose)
{ {
_onDispose = onDispose; _onDispose = onDispose;
Address = address; Address = address;

2
src/Avalonia.Visuals/VisualTree/IHostedVisualTreeRoot.cs

@ -11,6 +11,6 @@ namespace Avalonia.VisualTree
/// <value> /// <value>
/// The visual tree host. /// The visual tree host.
/// </value> /// </value>
IVisual Host { get; } IVisual? Host { get; }
} }
} }

2
src/Avalonia.Visuals/VisualTree/IVisualTreeHost.cs

@ -14,6 +14,6 @@ namespace Avalonia.VisualTree
/// <value> /// <value>
/// The root of the hosted visual tree. /// The root of the hosted visual tree.
/// </value> /// </value>
IVisual Root { get; } IVisual? Root { get; }
} }
} }

Loading…
Cancel
Save