Skip to content

Commit f6cc2ad

Browse files
authored
Merge pull request #160 from FmgLib/v8.8.8
V8.8.8
2 parents b466221 + 8bda606 commit f6cc2ad

14 files changed

+74
-33
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,10 @@ Simply specify the control for which you want to create extension methods as `[M
12991299

13001300
The constructor method of the `MauiMarkup()` attribute automatically generates extension methods for BindableProperties and Events found within the type provided as an argument. **You can provide a minimum of 1 type inside the constructor method, and there is no maximum limit.** **Multiple MauiMarkup attributes can be added to a single class.**
13011301

1302+
**NOTE: Suppose that if a property inherited from base classes has been redefined with the `new` keyword in the class where you want to create a Fluent Method, the name of the new Fluent Method will be `PropertyName + New`.**
1303+
1304+
For example, since the **Background** property in the **SfAvatarView** class is redefined with `new` and is the same as the **Background** in **VisualElement**, to prevent errors, the Fluent Method name for the **Background** property of the **SfAvatarView** class will be `BackgroundNew`.
1305+
13021306
Let's look at an example:
13031307

13041308
```csharp

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.AnimateTo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ void GenerateExtensionMethod_AnimateTo(PropInfo info, string transformationName)
77

88
if (mainSymbol.IsSealed)
99
builder.Append($@"
10-
public static Task<bool> Animate{info.propertyName}To(this {info.MainSymbolName} self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null)");
10+
public static Task<bool> Animate{info.methodName}To(this {info.MainSymbolName} self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null)");
1111
else
1212
builder.Append($@"
13-
public static Task<bool> Animate{info.propertyName}To<T>(this T self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null)
13+
public static Task<bool> Animate{info.methodName}To<T>(this T self, {info.propertyTypeName} value, uint length = 250, Easing? easing = null)
1414
where T : {info.MainSymbolName}");
1515

1616
var callBackSetValue = info.IsBindableProperty ? $"self.SetValue({info.BindablePropertyName}, actValue);" : $"self.{info.propertyName} = actValue;";

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.BindingBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void GenerateExtensionMethod_BindablePropertyBuilder(PropInfo info)
1313
void GenerateExtensionMethod_BindablePropertyBuilder_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self, Func<PropertyContext<{info.propertyTypeName}>, IPropertyBuilder<{info.propertyTypeName}>> configure)
16+
public static {info.MainSymbolName} {info.methodName}(this {info.MainSymbolName} self, Func<PropertyContext<{info.propertyTypeName}>, IPropertyBuilder<{info.propertyTypeName}>> configure)
1717
{{
1818
var context = new PropertyContext<{info.propertyTypeName}>(self, {info.BindablePropertyName});
1919
configure(context).Build();
@@ -25,7 +25,7 @@ void GenerateExtensionMethod_BindablePropertyBuilder_Sealed(PropInfo info)
2525
void GenerateExtensionMethod_BindablePropertyBuilder_Normal(PropInfo info)
2626
{
2727
builder.Append($@"
28-
public static T {info.propertyName}<T>(this T self, Func<PropertyContext<{info.propertyTypeName}>, IPropertyBuilder<{info.propertyTypeName}>> configure)
28+
public static T {info.methodName}<T>(this T self, Func<PropertyContext<{info.propertyTypeName}>, IPropertyBuilder<{info.propertyTypeName}>> configure)
2929
where T : {info.MainSymbolName}
3030
{{
3131
var context = new PropertyContext<{info.propertyTypeName}>(self, {info.BindablePropertyName});

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.ContentProp.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ void GenerateExtensionMethod_ContentProp_List(PropInfo info, string elementTypeN
2323
void GenerateExtensionMethod_ContentProp_Single_Sealed(PropInfo info)
2424
{
2525
builder.Append($@"
26-
public static {info.MainSymbolName} {info.propertyName}_ContentProp(this {info.MainSymbolName} self,
26+
public static {info.MainSymbolName} {info.methodName}_ContentProp(this {info.MainSymbolName} self,
2727
{info.propertyTypeName} {info.camelCaseName})
2828
{{
2929
self.{info.propertyName} = {info.camelCaseName};
3030
return self;
3131
}}
3232
33-
public static {info.MainSymbolName} {info.propertyName}_ContentProp(this {info.MainSymbolName} self,
33+
public static {info.MainSymbolName} {info.methodName}_ContentProp(this {info.MainSymbolName} self,
3434
Func<{info.propertyTypeName}> configure)
3535
{{
3636
var {info.camelCaseName} = configure();
@@ -43,15 +43,15 @@ void GenerateExtensionMethod_ContentProp_Single_Sealed(PropInfo info)
4343
void GenerateExtensionMethod_ContentProp_Single_Normal(PropInfo info)
4444
{
4545
builder.Append($@"
46-
public static T {info.propertyName}_ContentProp<T>(this T self,
46+
public static T {info.methodName}_ContentProp<T>(this T self,
4747
{info.propertyTypeName} {info.camelCaseName})
4848
where T : {info.MainSymbolName}
4949
{{
5050
self.{info.propertyName} = {info.camelCaseName};
5151
return self;
5252
}}
5353
54-
public static T {info.propertyName}_ContentProp<T>(this T self,
54+
public static T {info.methodName}_ContentProp<T>(this T self,
5555
Func<{info.propertyTypeName}> configure)
5656
where T : {info.MainSymbolName}
5757
{{
@@ -68,23 +68,23 @@ void GenerateExtensionMethod_ContentProp_List_Sealed(PropInfo info, string eleme
6868
{
6969
var tail = info.propertyTypeName.EndsWith("?") ? "?" : "";
7070
builder.Append($@"
71-
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self,
71+
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}(this {info.MainSymbolName} self,
7272
IList<{elementTypeName}> {info.camelCaseName})
7373
{{
7474
foreach (var item in {info.camelCaseName})
7575
self.{info.propertyName}{tail}.Add(item);
7676
return self;
7777
}}
7878
79-
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self,
79+
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}(this {info.MainSymbolName} self,
8080
params {elementTypeName}[] {info.camelCaseName})
8181
{{
8282
foreach (var item in {info.camelCaseName})
8383
self.{info.propertyName}{tail}.Add(item);
8484
return self;
8585
}}
8686
87-
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}(this {info.MainSymbolName} self,
87+
public static {info.MainSymbolName} {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}(this {info.MainSymbolName} self,
8888
Func<{elementTypeName}[]> configure)
8989
{{
9090
var {info.camelCaseName} = configure();
@@ -99,7 +99,7 @@ void GenerateExtensionMethod_ContentProp_List_Normal(PropInfo info, string eleme
9999
{
100100
var tail = info.propertyTypeName.EndsWith("?") ? "?" : "";
101101
builder.Append($@"
102-
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}<T>(this T self,
102+
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}<T>(this T self,
103103
IList<{elementTypeName}> {info.camelCaseName})
104104
where T : {info.MainSymbolName}
105105
{{
@@ -108,7 +108,7 @@ void GenerateExtensionMethod_ContentProp_List_Normal(PropInfo info, string eleme
108108
return self;
109109
}}
110110
111-
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}<T>(this T self,
111+
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}<T>(this T self,
112112
params {elementTypeName}[] {info.camelCaseName})
113113
where T : {info.MainSymbolName}
114114
{{
@@ -117,7 +117,7 @@ void GenerateExtensionMethod_ContentProp_List_Normal(PropInfo info, string eleme
117117
return self;
118118
}}
119119
120-
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.propertyName : fluentMethodName)}<T>(this T self,
120+
public static T {(string.IsNullOrEmpty(fluentMethodName) ? info.methodName : fluentMethodName)}<T>(this T self,
121121
Func<{elementTypeName}[]> configure)
122122
where T : {info.MainSymbolName}
123123
{{

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.DataTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void GenerateExtensionMethod_DataTemplate(PropInfo info)
1313
void GenerateExtensionMethod_DataTemplate_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static {info.MainSymbolName} {info.propertyName}<T>(this {info.MainSymbolName} self, System.Func<object> loadTemplate)
16+
public static {info.MainSymbolName} {info.methodName}<T>(this {info.MainSymbolName} self, System.Func<object> loadTemplate)
1717
{{
1818
{info.dataTemplateAssignmentString}
1919
return self;
@@ -24,7 +24,7 @@ void GenerateExtensionMethod_DataTemplate_Sealed(PropInfo info)
2424
void GenerateExtensionMethod_DataTemplate_Normal(PropInfo info)
2525
{
2626
builder.Append($@"
27-
public static T {info.propertyName}<T>(this T self, System.Func<object> loadTemplate)
27+
public static T {info.methodName}<T>(this T self, System.Func<object> loadTemplate)
2828
where T : {info.MainSymbolName}
2929
{{
3030
{info.dataTemplateAssignmentString}

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.GetValue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void GenerateExtensionMethod_GetValue(PropInfo info)
1313
void GenerateExtensionMethod_GetValue_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static {info.propertyTypeName} Get{info.propertyName}Value<T>(this {info.MainSymbolName} self)
16+
public static {info.propertyTypeName} Get{info.methodName}Value<T>(this {info.MainSymbolName} self)
1717
{{
1818
return ({info.propertyTypeName})self.GetValue({info.BindablePropertyName});
1919
}}
@@ -23,7 +23,7 @@ void GenerateExtensionMethod_GetValue_Sealed(PropInfo info)
2323
void GenerateExtensionMethod_GetValue_Normal(PropInfo info)
2424
{
2525
builder.Append($@"
26-
public static {info.propertyTypeName} Get{info.propertyName}Value<T>(this T self)
26+
public static {info.propertyTypeName} Get{info.methodName}Value<T>(this T self)
2727
where T : {info.MainSymbolName}
2828
{{
2929
return ({info.propertyTypeName})self.GetValue({info.BindablePropertyName});

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Lists.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ void GenerateExtensionMethod_List_Sealed(PropInfo info, string elementTypeName)
1414
{
1515
var tail = info.propertyTypeName.EndsWith("?") ? "?" : "";
1616
builder.Append($@"
17-
public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self,
17+
public static {info.MainSymbolName} {info.methodName}(this {info.MainSymbolName} self,
1818
IList<{elementTypeName}> {info.camelCaseName})
1919
{{
2020
foreach (var item in {info.camelCaseName})
2121
{info.accessedWith}.{info.propertyName}{tail}.Add(item);
2222
return self;
2323
}}
2424
25-
public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self,
25+
public static {info.MainSymbolName} {info.methodName}(this {info.MainSymbolName} self,
2626
params {elementTypeName}[] {info.camelCaseName})
2727
{{
2828
foreach (var item in {info.camelCaseName})

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.BindingBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void GenerateExtensionMethod_SettersBuilder(PropInfo info)
1313
void GenerateExtensionMethod_SettersBuilder_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static SettersContext<{info.MainSymbolName}> {info.propertyName}(this SettersContext<{info.MainSymbolName}> self, Func<PropertySettersContext<{info.propertyTypeName}>, IPropertySettersBuilder<{info.propertyTypeName}>> configure)
16+
public static SettersContext<{info.MainSymbolName}> {info.methodName}(this SettersContext<{info.MainSymbolName}> self, Func<PropertySettersContext<{info.propertyTypeName}>, IPropertySettersBuilder<{info.propertyTypeName}>> configure)
1717
{{
1818
var context = new PropertySettersContext<{info.propertyTypeName}>(self.XamlSetters, {info.BindablePropertyName});
1919
configure(context).Build();
@@ -25,7 +25,7 @@ void GenerateExtensionMethod_SettersBuilder_Sealed(PropInfo info)
2525
void GenerateExtensionMethod_SettersBuilder_Normal(PropInfo info)
2626
{
2727
builder.Append($@"
28-
public static SettersContext<T> {info.propertyName}<T>(this SettersContext<T> self, Func<PropertySettersContext<{info.propertyTypeName}>, IPropertySettersBuilder<{info.propertyTypeName}>> configure)
28+
public static SettersContext<T> {info.methodName}<T>(this SettersContext<T> self, Func<PropertySettersContext<{info.propertyTypeName}>, IPropertySettersBuilder<{info.propertyTypeName}>> configure)
2929
where T : {info.MainSymbolName}
3030
{{
3131
var context = new PropertySettersContext<{info.propertyTypeName}>(self.XamlSetters, {info.BindablePropertyName});

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Setters.Value.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void GenerateExtensionMethod_Setters(PropInfo info)
1313
void GenerateExtensionMethod_Setters_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static SettersContext<{info.MainSymbolName}> {info.propertyName}(this SettersContext<{info.MainSymbolName}> self,
16+
public static SettersContext<{info.MainSymbolName}> {info.methodName}(this SettersContext<{info.MainSymbolName}> self,
1717
{info.propertyTypeName} {info.camelCaseName})
1818
{{
1919
self.XamlSetters.Add(new Setter {{ Property = {info.BindablePropertyName}, Value = {info.camelCaseName} }});
@@ -25,7 +25,7 @@ void GenerateExtensionMethod_Setters_Sealed(PropInfo info)
2525
void GenerateExtensionMethod_Setters_Normal(PropInfo info)
2626
{
2727
builder.Append($@"
28-
public static SettersContext<T> {info.propertyName}<T>(this SettersContext<T> self,
28+
public static SettersContext<T> {info.methodName}<T>(this SettersContext<T> self,
2929
{info.propertyTypeName} {info.camelCaseName})
3030
where T : {info.MainSymbolName}
3131
{{

src/FmgLib.MauiMarkup.Generator/Extensions/ExtensionGenerator.Value.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ void GenerateExtensionMethod_Value(PropInfo info)
1313
void GenerateExtensionMethod_Value_Sealed(PropInfo info)
1414
{
1515
builder.Append($@"
16-
public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self,
16+
public static {info.MainSymbolName} {info.methodName}(this {info.MainSymbolName} self,
1717
{info.propertyTypeName} {info.camelCaseName})
1818
{{
1919
{info.valueAssignmentString}
2020
return self;
2121
}}
2222
23-
public static {info.MainSymbolName} {info.propertyName}(this {info.MainSymbolName} self,
23+
public static {info.MainSymbolName} {info.methodName}(this {info.MainSymbolName} self,
2424
Func<{info.propertyTypeName}> configure)
2525
{{
2626
var {info.camelCaseName} = configure();
@@ -35,15 +35,15 @@ void GenerateExtensionMethod_Value_Sealed(PropInfo info)
3535
void GenerateExtensionMethod_Value_Normal(PropInfo info)
3636
{
3737
builder.Append($@"
38-
public static T {info.propertyName}<T>(this T self,
38+
public static T {info.methodName}<T>(this T self,
3939
{info.propertyTypeName} {info.camelCaseName})
4040
where T : {info.MainSymbolName}
4141
{{
4242
{info.valueAssignmentString}
4343
return self;
4444
}}
4545
46-
public static T {info.propertyName}<T>(this T self,
46+
public static T {info.methodName}<T>(this T self,
4747
Func<{info.propertyTypeName}> configure)
4848
where T : {info.MainSymbolName}
4949
{{

0 commit comments

Comments
 (0)