FmgLib / FmgLib.MauiMarkup

C# Code Markup Library for .NET MAUI: UI Development, Multi Lang (Localization) with Fluent Methods and Hot Reload
https://fmgyazilim.com/en/fmglibmauimarkup
MIT License
52 stars 6 forks source link

While creating Fluent Methods for AttachedProperties, it also generates them repeatedly for the ContentProperty. #120

Closed gonultasmf closed 1 month ago

gonultasmf commented 1 month ago
//
// <auto-generated-fmglib-mauimarkup-generator />
//

namespace FmgLib.MauiMarkup;

public static partial class ShellAttachedExtension
{
        public static T Items_ContentProp<T>(this T self,
            IList<Microsoft.Maui.Controls.ShellItem> items)
            where T : Microsoft.Maui.Controls.Shell
        {
            foreach (var item in items)
                self.Items.Add(item);
            return self;
        }

        public static T Items_ContentProp<T>(this T self,
            params Microsoft.Maui.Controls.ShellItem[] items)
            where T : Microsoft.Maui.Controls.Shell
        {
            foreach (var item in items)
                self.Items.Add(item);
            return self;
        }

        public static T Items_ContentProp<T>(this T self,
            Func<Microsoft.Maui.Controls.ShellItem[]> configure)
            where T : Microsoft.Maui.Controls.Shell
        {
            var items = configure();
            foreach (var item in items)
                self.Items.Add(item);
            return self;
        }

        public static T ShellBackButtonBehavior<T>(this T self,
            Microsoft.Maui.Controls.BackButtonBehavior shellBackButtonBehavior)
            where T : Microsoft.Maui.Controls.Page
        {
            self.SetValue(Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, shellBackButtonBehavior);
            return self;
        }

        public static T ShellBackButtonBehavior<T>(this T self,
            Func<Microsoft.Maui.Controls.BackButtonBehavior> configure)
            where T : Microsoft.Maui.Controls.Page
        {
            var shellBackButtonBehavior = configure();
            self.SetValue(Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, shellBackButtonBehavior);
            return self;
        }

        public static T ShellBackButtonBehavior<T>(this T self, Func<PropertyContext<Microsoft.Maui.Controls.BackButtonBehavior>, IPropertyBuilder<Microsoft.Maui.Controls.BackButtonBehavior>> configure)
            where T : Microsoft.Maui.Controls.Page
        {
            var context = new PropertyContext<Microsoft.Maui.Controls.BackButtonBehavior>(self, Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty);
            configure(context).Build();
            return self;
        }

        public static SettersContext<T> ShellBackButtonBehavior<T>(this SettersContext<T> self,
            Microsoft.Maui.Controls.BackButtonBehavior shellBackButtonBehavior)
            where T : Microsoft.Maui.Controls.Page
        {
            self.XamlSetters.Add(new Setter { Property = Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty, Value = shellBackButtonBehavior });
            return self;
        }

        public static SettersContext<T> ShellBackButtonBehavior<T>(this SettersContext<T> self, Func<PropertySettersContext<Microsoft.Maui.Controls.BackButtonBehavior>, IPropertySettersBuilder<Microsoft.Maui.Controls.BackButtonBehavior>> configure)
            where T : Microsoft.Maui.Controls.Page
        {
            var context = new PropertySettersContext<Microsoft.Maui.Controls.BackButtonBehavior>(self.XamlSetters, Microsoft.Maui.Controls.Shell.BackButtonBehaviorProperty);
            configure(context).Build();
            return self;
        }

}