You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/CommonUsageTests.cs
+83-16Lines changed: 83 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,8 @@ public partial class {{defaultTestClassName}}
38
38
/// Backing BindableProperty for the <see cref = "Text"/> property.
public partial string Text { get => (string)GetValue(TextProperty); internal set => SetValue(TextProperty, value); }
397
+
bool __initializingText = false;
398
+
public partial string Text { get => __initializingText ? field : (string)GetValue(TextProperty); internal set => SetValue(TextProperty, field = value); }
390
399
}
391
400
""";
392
401
@@ -428,7 +437,8 @@ public partial class {{defaultTestClassName}}
public static readonly global::Microsoft.Maui.Controls.BindableProperty TextProperty = textPropertyKey.BindableProperty;
431
-
public partial string Text { get => (string)GetValue(TextProperty); private protected set => SetValue(textPropertyKey, value); }
440
+
bool __initializingText = false;
441
+
public partial string Text { get => __initializingText ? field : (string)GetValue(TextProperty); private protected set => SetValue(textPropertyKey, field = value); }
432
442
}
433
443
""";
434
444
@@ -469,7 +479,8 @@ public partial class {{defaultTestClassName}}
469
479
/// Backing BindableProperty for the <see cref = "Text"/> property.
public partial string Text { get => (string)GetValue(TextProperty); protected internal set => SetValue(TextProperty, value); }
482
+
bool __initializingText = false;
483
+
public partial string Text { get => __initializingText ? field : (string)GetValue(TextProperty); protected internal set => SetValue(TextProperty, field = value); }
473
484
}
474
485
""";
475
486
@@ -511,7 +522,8 @@ public partial class {{defaultTestClassName}}
public static readonly global::Microsoft.Maui.Controls.BindableProperty TextProperty = textPropertyKey.BindableProperty;
514
-
public partial string Text { get => (string)GetValue(TextProperty); protected set => SetValue(textPropertyKey, value); }
525
+
bool __initializingText = false;
526
+
public partial string Text { get => __initializingText ? field : (string)GetValue(TextProperty); protected set => SetValue(textPropertyKey, field = value); }
515
527
}
516
528
""";
517
529
@@ -553,7 +565,8 @@ public partial class {{defaultTestClassName}}
public static readonly global::Microsoft.Maui.Controls.BindableProperty TextProperty = textPropertyKey.BindableProperty;
556
-
public partial string Text { get => (string)GetValue(TextProperty); private set => SetValue(textPropertyKey, value); }
568
+
bool __initializingText = false;
569
+
public partial string Text { get => __initializingText ? field : (string)GetValue(TextProperty); private set => SetValue(textPropertyKey, field = value); }
557
570
}
558
571
""";
559
572
@@ -595,7 +608,8 @@ public partial class {{defaultTestClassName}}
public partial System.TimeSpan Position { get => (System.TimeSpan)GetValue(PositionProperty); set => SetValue(PositionProperty, value); }
657
+
bool __initializingPosition = false;
658
+
public partial System.TimeSpan Position { get => __initializingPosition ? field : (System.TimeSpan)GetValue(PositionProperty); set => SetValue(PositionProperty, field = value); }
644
659
645
660
/// <summary>
646
661
/// Backing BindableProperty for the <see cref = "CustomDuration"/> property.
647
662
/// </summary>
648
663
public static readonly global::Microsoft.Maui.Controls.BindableProperty CustomDurationProperty = global::Microsoft.Maui.Controls.BindableProperty.Create("CustomDuration", typeof(System.TimeSpan), typeof({{defaultTestNamespace}}.{{defaultTestClassName}}), new global::System.TimeSpan(900000000), Microsoft.Maui.Controls.BindingMode.OneWay, null, null, null, null, null);
649
-
public partial System.TimeSpan CustomDuration { get => (System.TimeSpan)GetValue(CustomDurationProperty); set => SetValue(CustomDurationProperty, value); }
664
+
bool __initializingCustomDuration = false;
665
+
public partial System.TimeSpan CustomDuration { get => __initializingCustomDuration ? field : (System.TimeSpan)GetValue(CustomDurationProperty); set => SetValue(CustomDurationProperty, field = value); }
0 commit comments