diff --git a/native/Avalonia.Native/src/OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm
index 9208848b4c..16f49b8e26 100644
--- a/native/Avalonia.Native/src/OSX/window.mm
+++ b/native/Avalonia.Native/src/OSX/window.mm
@@ -175,7 +175,7 @@ public:
{
if(Window != nullptr)
{
- [Window makeKeyWindow];
+ [Window makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];
}
}
diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs
index dddfa4bbb5..9a1101e637 100644
--- a/src/Avalonia.Base/AvaloniaObject.cs
+++ b/src/Avalonia.Base/AvaloniaObject.cs
@@ -115,8 +115,8 @@ namespace Avalonia
/// The binding information.
public IBinding this[IndexerDescriptor binding]
{
- get { return new IndexerBinding(this, binding.Property, binding.Mode); }
- set { this.Bind(binding.Property, value); }
+ get { return new IndexerBinding(this, binding.Property!, binding.Mode); }
+ set { this.Bind(binding.Property!, value); }
}
private ValueStore Values
diff --git a/src/Avalonia.Base/AvaloniaObjectExtensions.cs b/src/Avalonia.Base/AvaloniaObjectExtensions.cs
index 4e04a9045e..16f0ca38a7 100644
--- a/src/Avalonia.Base/AvaloniaObjectExtensions.cs
+++ b/src/Avalonia.Base/AvaloniaObjectExtensions.cs
@@ -662,9 +662,9 @@ namespace Avalonia
this._source = source;
}
- public InstancedBinding Initiate(
+ public InstancedBinding? Initiate(
IAvaloniaObject target,
- AvaloniaProperty targetProperty,
+ AvaloniaProperty? targetProperty,
object? anchor = null,
bool enableDataValidation = false)
{
diff --git a/src/Avalonia.Base/Data/AssignBindingAttribute.cs b/src/Avalonia.Base/Data/AssignBindingAttribute.cs
index 15bd32c7c2..f88055a1e1 100644
--- a/src/Avalonia.Base/Data/AssignBindingAttribute.cs
+++ b/src/Avalonia.Base/Data/AssignBindingAttribute.cs
@@ -1,5 +1,7 @@
using System;
+#nullable enable
+
namespace Avalonia.Data
{
///
diff --git a/src/Avalonia.Base/Data/BindingChainException.cs b/src/Avalonia.Base/Data/BindingChainException.cs
index 86112ce12d..09acf459cc 100644
--- a/src/Avalonia.Base/Data/BindingChainException.cs
+++ b/src/Avalonia.Base/Data/BindingChainException.cs
@@ -1,5 +1,7 @@
using System;
+#nullable enable
+
namespace Avalonia.Data
{
///
@@ -16,6 +18,7 @@ namespace Avalonia.Data
///
public BindingChainException()
{
+ _message = "Binding error";
}
///
@@ -45,12 +48,12 @@ namespace Avalonia.Data
///
/// Gets the expression that could not be evaluated.
///
- public string Expression { get; protected set; }
+ public string? Expression { get; protected set; }
///
/// Gets the point in the expression at which the error occurred.
///
- public string ExpressionErrorPoint { get; protected set; }
+ public string? ExpressionErrorPoint { get; protected set; }
///
public override string Message
diff --git a/src/Avalonia.Base/Data/BindingMode.cs b/src/Avalonia.Base/Data/BindingMode.cs
index 0d04c2eb10..a57487fa7a 100644
--- a/src/Avalonia.Base/Data/BindingMode.cs
+++ b/src/Avalonia.Base/Data/BindingMode.cs
@@ -1,3 +1,5 @@
+#nullable enable
+
namespace Avalonia.Data
{
///
diff --git a/src/Avalonia.Base/Data/BindingNotification.cs b/src/Avalonia.Base/Data/BindingNotification.cs
index 516c26d1d3..867a7f637a 100644
--- a/src/Avalonia.Base/Data/BindingNotification.cs
+++ b/src/Avalonia.Base/Data/BindingNotification.cs
@@ -1,5 +1,7 @@
using System;
+#nullable enable
+
namespace Avalonia.Data
{
///
@@ -47,13 +49,13 @@ namespace Avalonia.Data
public static readonly BindingNotification UnsetValue =
new BindingNotification(AvaloniaProperty.UnsetValue);
- private object _value;
+ private object? _value;
///
/// Initializes a new instance of the class.
///
/// The binding value.
- public BindingNotification(object value)
+ public BindingNotification(object? value)
{
_value = value;
}
@@ -81,7 +83,7 @@ namespace Avalonia.Data
/// The binding error.
/// The type of the binding error.
/// The fallback value.
- public BindingNotification(Exception error, BindingErrorType errorType, object fallbackValue)
+ public BindingNotification(Exception error, BindingErrorType errorType, object? fallbackValue)
: this(error, errorType)
{
_value = fallbackValue;
@@ -95,7 +97,7 @@ namespace Avalonia.Data
/// If this property is read when is false then it will return
/// .
///
- public object Value => _value;
+ public object? Value => _value;
///
/// Gets a value indicating whether should be pushed to the target.
@@ -105,7 +107,7 @@ namespace Avalonia.Data
///
/// Gets the error that occurred on the source, if any.
///
- public Exception Error { get; set; }
+ public Exception? Error { get; set; }
///
/// Gets the type of error that represents, if any.
@@ -118,14 +120,14 @@ namespace Avalonia.Data
/// The first instance.
/// The second instance.
/// true if the two instances are equal; otherwise false.
- public static bool operator ==(BindingNotification a, BindingNotification b)
+ public static bool operator ==(BindingNotification? a, BindingNotification? b)
{
if (object.ReferenceEquals(a, b))
{
return true;
}
- if ((object)a == null || (object)b == null)
+ if (a is null || b is null)
{
return false;
}
@@ -142,7 +144,7 @@ namespace Avalonia.Data
/// The first instance.
/// The second instance.
/// true if the two instances are unequal; otherwise false.
- public static bool operator !=(BindingNotification a, BindingNotification b)
+ public static bool operator !=(BindingNotification? a, BindingNotification? b)
{
return !(a == b);
}
@@ -156,10 +158,10 @@ namespace Avalonia.Data
/// If is a then returns the binding
/// notification's . If not, returns the object unchanged.
///
- public static object ExtractValue(object o)
+ public static object? ExtractValue(object? o)
{
var notification = o as BindingNotification;
- return notification != null ? notification.Value : o;
+ return notification is not null ? notification.Value : o;
}
///
@@ -171,7 +173,7 @@ namespace Avalonia.Data
/// If is a then returns the binding
/// notification's . If not, returns the object unchanged.
///
- public static object ExtractError(object o)
+ public static object? ExtractError(object? o)
{
return o is BindingNotification notification ? notification.Error : o;
}
@@ -181,7 +183,7 @@ namespace Avalonia.Data
///
/// The object to compare.
/// true if the two instances are equal; otherwise false.
- public override bool Equals(object obj)
+ public override bool Equals(object? obj)
{
return Equals(obj as BindingNotification);
}
@@ -191,7 +193,7 @@ namespace Avalonia.Data
///
/// The value to compare.
/// true if the two instances are equal; otherwise false.
- public bool Equals(BindingNotification other)
+ public bool Equals(BindingNotification? other)
{
return this == other;
}
@@ -234,28 +236,28 @@ namespace Avalonia.Data
///
/// Sets the .
///
- public void SetValue(object value)
+ public void SetValue(object? value)
{
_value = value;
}
- public BindingValue