diff --git a/.gitignore b/.gitignore
index bbf358b8f4..ee778ed4e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,6 +102,7 @@ csx
AppPackages/
# NCrunch
+.NCrunch_*/
_NCrunch_*/
*.ncrunchsolution.user
nCrunchTemp_*
diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm
index b1fb915e04..16e1486acc 100644
--- a/native/Avalonia.Native/src/OSX/AvnWindow.mm
+++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm
@@ -394,7 +394,7 @@
- (BOOL)windowShouldZoom:(NSWindow *_Nonnull)window toFrame:(NSRect)newFrame
{
- return true;
+ return _parent->CanZoom();
}
-(void)windowDidResignKey:(NSNotification *)notification
diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h
index be7d933b6a..bc35ca670f 100644
--- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h
+++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h
@@ -107,6 +107,8 @@ BEGIN_INTERFACE_MAP()
virtual HRESULT GetInputMethod(IAvnTextInputMethod **retOut) override;
+ virtual bool CanZoom() { return false; }
+
protected:
virtual NSWindowStyleMask CalculateStyleMask() = 0;
virtual void UpdateStyle();
diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.h b/native/Avalonia.Native/src/OSX/WindowImpl.h
index 29bb659039..5140124a17 100644
--- a/native/Avalonia.Native/src/OSX/WindowImpl.h
+++ b/native/Avalonia.Native/src/OSX/WindowImpl.h
@@ -97,6 +97,8 @@ BEGIN_INTERFACE_MAP()
bool CanBecomeKeyWindow ();
+ bool CanZoom() override { return _isEnabled && _canResize; }
+
protected:
virtual NSWindowStyleMask CalculateStyleMask() override;
void UpdateStyle () override;
diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm
index 840f2c9e88..104611eabc 100644
--- a/native/Avalonia.Native/src/OSX/WindowImpl.mm
+++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm
@@ -622,5 +622,5 @@ void WindowImpl::UpdateStyle() {
[miniaturizeButton setHidden:!hasTrafficLights];
[miniaturizeButton setEnabled:_isEnabled];
[zoomButton setHidden:!hasTrafficLights];
- [zoomButton setEnabled:_isEnabled && _canResize];
+ [zoomButton setEnabled:CanZoom()];
}
diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs
index 24244c5068..bda30c08fb 100644
--- a/src/Avalonia.Base/AvaloniaProperty.cs
+++ b/src/Avalonia.Base/AvaloniaProperty.cs
@@ -257,7 +257,18 @@ namespace Avalonia
return result;
}
- ///
+ ///
+ /// Registers an attached .
+ ///
+ /// The type of the class that is registering the property.
+ /// The type of the property's value.
+ /// The name of the property.
+ /// The default value of the property.
+ /// Whether the property inherits its value.
+ /// The default binding mode for the property.
+ /// A value validation callback.
+ /// A value coercion callback.
+ /// if is set to true enable data validation.
///
/// A method that gets called before and after the property starts being notified on an
/// object; the bool argument will be true before and false afterwards. This callback is
diff --git a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs
index fc0ca2323e..8e6f7b0983 100644
--- a/src/Avalonia.Base/AvaloniaPropertyRegistry.cs
+++ b/src/Avalonia.Base/AvaloniaPropertyRegistry.cs
@@ -364,7 +364,7 @@ namespace Avalonia
/// The property.
///
/// You won't usually want to call this method directly, instead use the
- ///
+ ///
/// method.
///
public void Register(Type type, AvaloniaProperty property)
diff --git a/src/Avalonia.Base/Media/DrawingGroup.cs b/src/Avalonia.Base/Media/DrawingGroup.cs
index a41054202e..5f87da9dcd 100644
--- a/src/Avalonia.Base/Media/DrawingGroup.cs
+++ b/src/Avalonia.Base/Media/DrawingGroup.cs
@@ -117,10 +117,10 @@ namespace Avalonia.Media
// root DrawingGroup, and be the same value as the root _currentDrawingGroup.
//
// Either way, _rootDrawing always references the root drawing.
- protected Drawing? _rootDrawing;
+ private Drawing? _rootDrawing;
// Current DrawingGroup that new children are added to
- protected DrawingGroup? _currentDrawingGroup;
+ private DrawingGroup? _currentDrawingGroup;
// Previous values of _currentDrawingGroup
private Stack? _previousDrawingGroupStack;
diff --git a/src/Avalonia.Base/Media/FontManager.cs b/src/Avalonia.Base/Media/FontManager.cs
index 1c051e19e7..f785a7ed4e 100644
--- a/src/Avalonia.Base/Media/FontManager.cs
+++ b/src/Avalonia.Base/Media/FontManager.cs
@@ -107,7 +107,7 @@ namespace Avalonia.Media
source = new Uri(key.BaseUri, source);
}
- if (!_fontCollections.TryGetValue(source, out var fontCollection))
+ if (!_fontCollections.TryGetValue(source, out var fontCollection) && (source.IsAbsoluteResm() || source.IsAvares()))
{
var embeddedFonts = new EmbeddedFontCollection(source, source);
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
index 12efb3c383..a40cbf95ad 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
@@ -658,7 +658,7 @@ namespace Avalonia.Media.TextFormatting
/// Performs text wrapping returns a list of text lines.
///
///
- /// Whether can be reused to store the split runs.
+ /// Whether can be reused to store the split runs.
/// The first text source index.
/// The paragraph width.
/// The text paragraph properties.
diff --git a/src/Avalonia.Base/Platform/IDrawingContextImpl.cs b/src/Avalonia.Base/Platform/IDrawingContextImpl.cs
index 8962bc1586..ffdfa9aac1 100644
--- a/src/Avalonia.Base/Platform/IDrawingContextImpl.cs
+++ b/src/Avalonia.Base/Platform/IDrawingContextImpl.cs
@@ -128,6 +128,7 @@ namespace Avalonia.Platform
/// Pushes an opacity value.
///
/// The opacity.
+ /// where to apply the opacity.
void PushOpacity(double opacity, Rect bounds);
///
diff --git a/src/Avalonia.Base/Rendering/DisplayDirtyRect.cs b/src/Avalonia.Base/Rendering/DisplayDirtyRect.cs
index 7e6c3062cd..7a89e5b3cc 100644
--- a/src/Avalonia.Base/Rendering/DisplayDirtyRect.cs
+++ b/src/Avalonia.Base/Rendering/DisplayDirtyRect.cs
@@ -3,7 +3,7 @@
namespace Avalonia.Rendering
{
///
- /// Holds the state for a dirty rect rendered when is set.
+ /// Holds the state for a dirty rect rendered when is set.
///
internal class DisplayDirtyRect
{
diff --git a/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs
index 3ab535897a..f64a3e845d 100644
--- a/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs
+++ b/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs
@@ -17,7 +17,6 @@ namespace Avalonia.Rendering.SceneGraph
/// The fill brush.
/// The stroke pen.
/// The geometry.
- /// Auxiliary data required to draw the brush.
public GeometryNode(Matrix transform,
IImmutableBrush? brush,
IPen? pen,
diff --git a/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs
index f21791d038..61bffc3260 100644
--- a/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs
+++ b/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs
@@ -17,7 +17,6 @@ namespace Avalonia.Rendering.SceneGraph
/// The stroke pen.
/// The start point of the line.
/// The end point of the line.
- /// Auxiliary data required to draw the brush.
public LineNode(
Matrix transform,
IPen pen,
diff --git a/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs
index e10d712c2d..b0584038a8 100644
--- a/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs
+++ b/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs
@@ -17,7 +17,6 @@ namespace Avalonia.Rendering.SceneGraph
///
/// The opacity mask to push.
/// The bounds of the mask.
- /// Auxiliary data required to draw the brush.
public OpacityMaskNode(IImmutableBrush mask, Rect bounds)
: base(default, Matrix.Identity, mask)
{
diff --git a/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs
index cee9ce9df7..94f61df47d 100644
--- a/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs
+++ b/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs
@@ -20,7 +20,6 @@ namespace Avalonia.Rendering.SceneGraph
/// The stroke pen.
/// The rectangle to draw.
/// The box shadow parameters
- /// Auxiliary data required to draw the brush.
public RectangleNode(
Matrix transform,
IImmutableBrush? brush,
diff --git a/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs b/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs
index 4e0d37479b..a10b3eb3ea 100644
--- a/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs
+++ b/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs
@@ -52,7 +52,7 @@ namespace Avalonia.Styling
return result;
}
- protected TypeNameAndClassSelector(Selector? previous)
+ TypeNameAndClassSelector(Selector? previous)
{
_previous = previous;
}
diff --git a/src/Avalonia.Controls/ItemsSourceView.cs b/src/Avalonia.Controls/ItemsSourceView.cs
index c8fc76255c..416b909219 100644
--- a/src/Avalonia.Controls/ItemsSourceView.cs
+++ b/src/Avalonia.Controls/ItemsSourceView.cs
@@ -27,6 +27,7 @@ namespace Avalonia.Controls
private readonly IList _inner;
private NotifyCollectionChangedEventHandler? _collectionChanged;
+ private NotifyCollectionChangedEventHandler? _preCollectionChanged;
private NotifyCollectionChangedEventHandler? _postCollectionChanged;
private bool _listening;
@@ -70,7 +71,7 @@ namespace Avalonia.Controls
/// Gets a value that indicates whether the items source can provide a unique key for each item.
///
///
- /// TODO: Not yet implemented in Avalonia.
+ /// Not implemented in Avalonia, preserved here for ItemsRepeater's usage.
///
internal bool HasKeyIndexMapping => false;
@@ -92,6 +93,25 @@ namespace Avalonia.Controls
}
}
+ ///
+ /// Occurs when a collection has finished changing and all
+ /// event handlers have been notified.
+ ///
+ internal event NotifyCollectionChangedEventHandler? PreCollectionChanged
+ {
+ add
+ {
+ AddListenerIfNecessary();
+ _preCollectionChanged += value;
+ }
+
+ remove
+ {
+ _preCollectionChanged -= value;
+ RemoveListenerIfNecessary();
+ }
+ }
+
///
/// Occurs when a collection has finished changing and all
/// event handlers have been notified.
@@ -229,6 +249,7 @@ namespace Avalonia.Controls
void ICollectionChangedListener.PreChanged(INotifyCollectionChanged sender, NotifyCollectionChangedEventArgs e)
{
+ _preCollectionChanged?.Invoke(this, e);
}
void ICollectionChangedListener.Changed(INotifyCollectionChanged sender, NotifyCollectionChangedEventArgs e)
diff --git a/src/Avalonia.Controls/Platform/IInsetsManager.cs b/src/Avalonia.Controls/Platform/IInsetsManager.cs
index 6288142805..072bace154 100644
--- a/src/Avalonia.Controls/Platform/IInsetsManager.cs
+++ b/src/Avalonia.Controls/Platform/IInsetsManager.cs
@@ -36,7 +36,7 @@ namespace Avalonia.Controls.Platform
SafeAreaPadding = safeArePadding;
}
- ///
+ ///
public Thickness SafeAreaPadding { get; }
}
diff --git a/src/Avalonia.Controls/Selection/InternalSelectionModel.cs b/src/Avalonia.Controls/Selection/InternalSelectionModel.cs
index d0715e402d..d0e6144f59 100644
--- a/src/Avalonia.Controls/Selection/InternalSelectionModel.cs
+++ b/src/Avalonia.Controls/Selection/InternalSelectionModel.cs
@@ -203,7 +203,7 @@ namespace Avalonia.Controls.Selection
}
}
- private protected override void OnSourceCollectionChanged(NotifyCollectionChangedEventArgs e)
+ protected override void OnSourceCollectionChanged(NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Reset)
{
diff --git a/src/Avalonia.Controls/Selection/SelectedItems.cs b/src/Avalonia.Controls/Selection/SelectedItems.cs
index ef642b7bdc..74007805cd 100644
--- a/src/Avalonia.Controls/Selection/SelectedItems.cs
+++ b/src/Avalonia.Controls/Selection/SelectedItems.cs
@@ -5,7 +5,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Avalonia.Controls.Selection
{
- internal class SelectedItems : IReadOnlyList
+ internal class SelectedItems : IReadOnlyList
{
private readonly SelectionModel? _owner;
private readonly ItemsSourceView? _items;
@@ -19,12 +19,9 @@ namespace Avalonia.Controls.Selection
_items = items;
}
- [MaybeNull]
- public T this[int index]
+ public T? this[int index]
{
-#pragma warning disable CS8766
get
-#pragma warning restore CS8766
{
if (index >= Count)
{
@@ -64,15 +61,13 @@ namespace Avalonia.Controls.Selection
private ItemsSourceView? Items => _items ?? _owner?.ItemsView;
private IReadOnlyList? Ranges => _ranges ?? _owner!.Ranges;
- public IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
if (_owner?.SingleSelect == true)
{
if (_owner.SelectedIndex >= 0)
{
-#pragma warning disable CS8603
yield return _owner.SelectedItem;
-#pragma warning restore CS8603
}
}
else
@@ -83,9 +78,7 @@ namespace Avalonia.Controls.Selection
{
for (var i = range.Begin; i <= range.End; ++i)
{
-#pragma warning disable CS8603
yield return items is object ? items[i] : default;
-#pragma warning restore CS8603
}
}
}
@@ -102,8 +95,8 @@ namespace Avalonia.Controls.Selection
public class Untyped : IReadOnlyList