diff --git a/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs b/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs
index 79d52868e3..5c7d7d8605 100644
--- a/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs
+++ b/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs
@@ -103,6 +103,22 @@ namespace Avalonia.Utilities
ThrowDuplicate();
InsertEntry(new Entry(property, value), index);
}
+
+ ///
+ /// Removes all keys and values from the collection.
+ ///
+ ///
+ /// The Count property is set to 0, and references to other objects from elements of the
+ /// collection are also released. The capacity remains unchanged.
+ ///
+ public void Clear()
+ {
+ if (_entries is not null)
+ {
+ Array.Clear(_entries, 0, _entries.Length);
+ _entryCount = 0;
+ }
+ }
///
/// Determines whether the collection contains the specified key.