-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from fnajera-rac-de/default-value-raw
Default value raw
- Loading branch information
Showing
27 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
.../AutoBindableTest.Create_With_DefaultValueRaw_As_String#AutoBindableAttribute.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//HintName: AutoBindableAttribute.cs | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
using System; | ||
namespace Maui.BindableProperty.Generator.Core | ||
{ | ||
public enum BindablePropertyAccessibility | ||
{ | ||
/// <summary> | ||
/// If 'Undefined', bindable property will be defined in the same way as the class that contains it. | ||
/// </summary> | ||
Undefined = 0, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'private' | ||
/// </summary> | ||
Private = 1, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'private protected' | ||
/// </summary> | ||
ProtectedAndInternal = 2, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'protected' | ||
/// </summary> | ||
Protected = 3, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'internal' | ||
/// </summary> | ||
Internal = 4, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'protected internal' | ||
/// </summary> | ||
ProtectedOrInternal = 5, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'public' | ||
/// </summary> | ||
Public = 6 | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
[System.Diagnostics.Conditional("AutoBindableGenerator_DEBUG")] | ||
public sealed class AutoBindableAttribute : Attribute | ||
{ | ||
public AutoBindableAttribute(){} | ||
|
||
public string PropertyName { get; set; } = string.Empty; | ||
|
||
public string? OnChanged { get; set; } | ||
|
||
public string? OnChanging { get; set; } | ||
|
||
public string? DefaultValue { get; set; } | ||
|
||
public string? DefaultValueRaw { get; set; } | ||
|
||
public string? DefaultBindingMode { get; set; } | ||
|
||
public string? ValidateValue { get; set; } | ||
|
||
public bool HidesUnderlyingProperty { get; set; } = false; | ||
|
||
public BindablePropertyAccessibility PropertyAccessibility { get; set; } = BindablePropertyAccessibility.Undefined; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...utoBindableTest.Create_With_DefaultValueRaw_As_String#HeaderControl.generated.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//HintName: HeaderControl.generated.cs | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace Maui.BindableProperty.Generator.Demo.CustomControls | ||
{ | ||
public partial class HeaderControl | ||
{ | ||
/// <inheritdoc cref="_country"/> | ||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
public static readonly Microsoft.Maui.Controls.BindableProperty CountryProperty = | ||
Microsoft.Maui.Controls.BindableProperty.Create( | ||
nameof(Country), | ||
typeof(string), | ||
typeof(HeaderControl), | ||
defaultValue: MyDefaultValue, | ||
propertyChanged: __CountryChanged, | ||
propertyChanging: __CountryChanging); | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public string Country | ||
{ | ||
get => (string)GetValue(CountryProperty); | ||
set => SetValue(CountryProperty, value); | ||
} | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
private static void __CountryChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue) | ||
{ | ||
var ctrl = (global::Maui.BindableProperty.Generator.Demo.CustomControls.HeaderControl)bindable; | ||
ctrl.OnCountryChanged((string)newValue); | ||
} | ||
|
||
partial void OnCountryChanged(string value); | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
private static void __CountryChanging(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue) | ||
{ | ||
var ctrl = (global::Maui.BindableProperty.Generator.Demo.CustomControls.HeaderControl)bindable; | ||
ctrl.OnCountryChanging((string)oldValue); | ||
} | ||
|
||
partial void OnCountryChanging(string value); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...utoBindableTest.Create_With_DefaultValue_As_String_Code#AutoBindableAttribute.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//HintName: AutoBindableAttribute.cs | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
using System; | ||
namespace Maui.BindableProperty.Generator.Core | ||
{ | ||
public enum BindablePropertyAccessibility | ||
{ | ||
/// <summary> | ||
/// If 'Undefined', bindable property will be defined in the same way as the class that contains it. | ||
/// </summary> | ||
Undefined = 0, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'private' | ||
/// </summary> | ||
Private = 1, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'private protected' | ||
/// </summary> | ||
ProtectedAndInternal = 2, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'protected' | ||
/// </summary> | ||
Protected = 3, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'internal' | ||
/// </summary> | ||
Internal = 4, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'protected internal' | ||
/// </summary> | ||
ProtectedOrInternal = 5, | ||
|
||
/// <summary> | ||
/// Bindable property will be defined as 'public' | ||
/// </summary> | ||
Public = 6 | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] | ||
[System.Diagnostics.Conditional("AutoBindableGenerator_DEBUG")] | ||
public sealed class AutoBindableAttribute : Attribute | ||
{ | ||
public AutoBindableAttribute(){} | ||
|
||
public string PropertyName { get; set; } = string.Empty; | ||
|
||
public string? OnChanged { get; set; } | ||
|
||
public string? OnChanging { get; set; } | ||
|
||
public string? DefaultValue { get; set; } | ||
|
||
public string? DefaultValueRaw { get; set; } | ||
|
||
public string? DefaultBindingMode { get; set; } | ||
|
||
public string? ValidateValue { get; set; } | ||
|
||
public bool HidesUnderlyingProperty { get; set; } = false; | ||
|
||
public BindablePropertyAccessibility PropertyAccessibility { get; set; } = BindablePropertyAccessibility.Undefined; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...oBindableTest.Create_With_DefaultValue_As_String_Code#HeaderControl.generated.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//HintName: HeaderControl.generated.cs | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace Maui.BindableProperty.Generator.Demo.CustomControls | ||
{ | ||
public partial class HeaderControl | ||
{ | ||
/// <inheritdoc cref="_country"/> | ||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
public static readonly Microsoft.Maui.Controls.BindableProperty CountryProperty = | ||
Microsoft.Maui.Controls.BindableProperty.Create( | ||
nameof(Country), | ||
typeof(string), | ||
typeof(HeaderControl), | ||
defaultValue: "" + MyDefaultValue + "", | ||
propertyChanged: __CountryChanged, | ||
propertyChanging: __CountryChanging); | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public string Country | ||
{ | ||
get => (string)GetValue(CountryProperty); | ||
set => SetValue(CountryProperty, value); | ||
} | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
private static void __CountryChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue) | ||
{ | ||
var ctrl = (global::Maui.BindableProperty.Generator.Demo.CustomControls.HeaderControl)bindable; | ||
ctrl.OnCountryChanged((string)newValue); | ||
} | ||
|
||
partial void OnCountryChanged(string value); | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.11.1.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
private static void __CountryChanging(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue) | ||
{ | ||
var ctrl = (global::Maui.BindableProperty.Generator.Demo.CustomControls.HeaderControl)bindable; | ||
ctrl.OnCountryChanging((string)oldValue); | ||
} | ||
|
||
partial void OnCountryChanging(string value); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.