@@ -238,6 +238,12 @@ public void Unregister(Type type)
238
238
/// <typeparam name="TValue">The type of the property's value.</typeparam>
239
239
/// <param name="name">The name of the property.</param>
240
240
/// <param name="defaultValue">The default value of the property.</param>
241
+ /// <remarks>
242
+ /// <b>⚠️ Be cautious:</b> if <c>defaultValue</c> is a reference type (like a list), this same instance
243
+ /// will be shared across all controls using this property.<br/>
244
+ /// Use value types (like <c>int</c>, <c>bool</c>) or immutable objects only.<br/>
245
+ /// For collections or mutable types, use a factory pattern instead.
246
+ /// </remarks>
241
247
/// <param name="inherits">Whether the property inherits its value.</param>
242
248
/// <param name="defaultBindingMode">The default binding mode for the property.</param>
243
249
/// <param name="validate">A value validation callback.</param>
@@ -280,6 +286,12 @@ public static StyledProperty<TValue> Register<TOwner, TValue>(
280
286
/// <typeparam name="TValue">The type of the property's value.</typeparam>
281
287
/// <param name="name">The name of the property.</param>
282
288
/// <param name="defaultValue">The default value of the property.</param>
289
+ /// <remarks>
290
+ /// <b>⚠️ Be cautious:</b> if <c>defaultValue</c> is a reference type (like a list), this same instance
291
+ /// will be shared across all controls using this property.<br/>
292
+ /// Use value types (like <c>int</c>, <c>bool</c>) or immutable objects only.<br/>
293
+ /// For collections or mutable types, use a factory pattern instead.
294
+ /// </remarks>
283
295
/// <param name="inherits">Whether the property inherits its value.</param>
284
296
/// <param name="defaultBindingMode">The default binding mode for the property.</param>
285
297
/// <param name="validate">A value validation callback.</param>
@@ -329,6 +341,12 @@ internal static StyledProperty<TValue> Register<TOwner, TValue>(
329
341
/// <typeparam name="TValue">The type of the property's value.</typeparam>
330
342
/// <param name="name">The name of the property.</param>
331
343
/// <param name="defaultValue">The default value of the property.</param>
344
+ /// <remarks>
345
+ /// <b>⚠️ Be cautious:</b> if <c>defaultValue</c> is a reference type (like a list), this same instance
346
+ /// will be shared across all controls using this property.<br/>
347
+ /// Use value types (like <c>int</c>, <c>bool</c>) or immutable objects only.<br/>
348
+ /// For collections or mutable types, use a factory pattern instead.
349
+ /// </remarks>
332
350
/// <param name="inherits">Whether the property inherits its value.</param>
333
351
/// <param name="defaultBindingMode">The default binding mode for the property.</param>
334
352
/// <param name="validate">A value validation callback.</param>
@@ -365,6 +383,12 @@ public static AttachedProperty<TValue> RegisterAttached<TOwner, THost, TValue>(
365
383
/// <param name="name">The name of the property.</param>
366
384
/// <param name="ownerType">The type of the class that is registering the property.</param>
367
385
/// <param name="defaultValue">The default value of the property.</param>
386
+ /// <remarks>
387
+ /// <b>⚠️ Be cautious:</b> if <c>defaultValue</c> is a reference type (like a list), this same instance
388
+ /// will be shared across all controls using this property.<br/>
389
+ /// Use value types (like <c>int</c>, <c>bool</c>) or immutable objects only.<br/>
390
+ /// For collections or mutable types, use a factory pattern instead.
391
+ /// </remarks>
368
392
/// <param name="inherits">Whether the property inherits its value.</param>
369
393
/// <param name="defaultBindingMode">The default binding mode for the property.</param>
370
394
/// <param name="validate">A value validation callback.</param>
@@ -402,7 +426,11 @@ public static AttachedProperty<TValue> RegisterAttached<THost, TValue>(
402
426
/// <param name="name">The name of the property.</param>
403
427
/// <param name="getter">Gets the current value of the property.</param>
404
428
/// <param name="setter">Sets the value of the property.</param>
405
- /// <param name="unsetValue">The value to use when the property is cleared.</param>
429
+ /// <param name="unsetValue">
430
+ /// The value to use when the property is cleared.
431
+ /// ⚠️ Be careful with reference types: if you pass a mutable object (like a list),
432
+ /// it will be shared across all instances using this property. Use value types or immutable objects.
433
+ /// </param>
406
434
/// <param name="defaultBindingMode">The default binding mode for the property.</param>
407
435
/// <param name="enableDataValidation">
408
436
/// Whether the property is interested in data validation.
0 commit comments