Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gonultasmf opened this issue Aug 25, 2024 · 0 comments · Fixed by #122
Assignees
Labels
bug Something isn't working FmgLib.MauiMarkup.Generator FmgLib.MauiMarkup.Generator issue FmgLib.MauiMarkup FmgLib.MauiMarkup issue

Comments

@gonultasmf
Copy link
Member

//
// <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;
        }
        
}

@gonultasmf gonultasmf added bug Something isn't working FmgLib.MauiMarkup FmgLib.MauiMarkup issue FmgLib.MauiMarkup.Generator FmgLib.MauiMarkup.Generator issue labels Aug 25, 2024
@gonultasmf gonultasmf self-assigned this Aug 25, 2024
gonultasmf added a commit that referenced this issue Aug 25, 2024
@gonultasmf gonultasmf linked a pull request Aug 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FmgLib.MauiMarkup.Generator FmgLib.MauiMarkup.Generator issue FmgLib.MauiMarkup FmgLib.MauiMarkup issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant