diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs index 3af338d740..8b7a56a9f6 100644 --- a/src/Avalonia.Base/AvaloniaProperty.cs +++ b/src/Avalonia.Base/AvaloniaProperty.cs @@ -238,6 +238,12 @@ namespace Avalonia /// The type of the property's value. /// The name of the property. /// The default value of the property. + /// + /// ⚠️ Be cautious: if defaultValue is a reference type (like a list), this same instance + /// will be shared across all controls using this property.
+ /// Use value types (like int, bool) or immutable objects only.
+ /// For collections or mutable types, use a factory pattern instead. + ///
/// Whether the property inherits its value. /// The default binding mode for the property. /// A value validation callback. @@ -280,6 +286,12 @@ namespace Avalonia /// The type of the property's value. /// The name of the property. /// The default value of the property. + /// + /// ⚠️ Be cautious: if defaultValue is a reference type (like a list), this same instance + /// will be shared across all controls using this property.
+ /// Use value types (like int, bool) or immutable objects only.
+ /// For collections or mutable types, use a factory pattern instead. + ///
/// Whether the property inherits its value. /// The default binding mode for the property. /// A value validation callback. @@ -329,6 +341,12 @@ namespace Avalonia /// The type of the property's value. /// The name of the property. /// The default value of the property. + /// + /// ⚠️ Be cautious: if defaultValue is a reference type (like a list), this same instance + /// will be shared across all controls using this property.
+ /// Use value types (like int, bool) or immutable objects only.
+ /// For collections or mutable types, use a factory pattern instead. + ///
/// Whether the property inherits its value. /// The default binding mode for the property. /// A value validation callback. @@ -365,6 +383,12 @@ namespace Avalonia /// The name of the property. /// The type of the class that is registering the property. /// The default value of the property. + /// + /// ⚠️ Be cautious: if defaultValue is a reference type (like a list), this same instance + /// will be shared across all controls using this property.
+ /// Use value types (like int, bool) or immutable objects only.
+ /// For collections or mutable types, use a factory pattern instead. + ///
/// Whether the property inherits its value. /// The default binding mode for the property. /// A value validation callback. @@ -402,7 +426,11 @@ namespace Avalonia /// The name of the property. /// Gets the current value of the property. /// Sets the value of the property. - /// The value to use when the property is cleared. + /// + /// The value to use when the property is cleared. + /// ⚠️ Be careful with reference types: if you pass a mutable object (like a list), + /// it will be shared across all instances using this property. Use value types or immutable objects. + /// /// The default binding mode for the property. /// /// Whether the property is interested in data validation.