{"id":13629491,"url":"https://github.com/rrmanzano/maui-bindableproperty-generator","last_synced_at":"2026-01-16T07:33:34.975Z","repository":{"id":38128442,"uuid":"476831446","full_name":"rrmanzano/maui-bindableproperty-generator","owner":"rrmanzano","description":"Source generator that automatically transforms fields into BindableProperties that can be used in MAUI","archived":false,"fork":false,"pushed_at":"2023-12-20T22:39:11.000Z","size":285,"stargazers_count":142,"open_issues_count":13,"forks_count":12,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-10-05T01:49:57.851Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rrmanzano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-04-01T18:36:41.000Z","updated_at":"2025-09-23T03:05:11.000Z","dependencies_parsed_at":"2023-12-21T00:55:51.346Z","dependency_job_id":"79ae4b49-b993-4595-8fb3-3236a546246c","html_url":"https://github.com/rrmanzano/maui-bindableproperty-generator","commit_stats":{"total_commits":30,"total_committers":3,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"d957d2c662b2414a54259b25565852b9ea6a4247"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rrmanzano/maui-bindableproperty-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrmanzano%2Fmaui-bindableproperty-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrmanzano%2Fmaui-bindableproperty-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrmanzano%2Fmaui-bindableproperty-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrmanzano%2Fmaui-bindableproperty-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrmanzano","download_url":"https://codeload.github.com/rrmanzano/maui-bindableproperty-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrmanzano%2Fmaui-bindableproperty-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:01:11.977Z","updated_at":"2026-01-16T07:33:34.950Z","avatar_url":"https://github.com/rrmanzano.png","language":"C#","funding_links":[],"categories":["Contributors Welcome for those","Plugins"],"sub_categories":["1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category","Get Started"],"readme":"[![NuGet](http://img.shields.io/nuget/vpre/M.BindableProperty.Generator.svg?label=NuGet)](https://www.nuget.org/packages/M.BindableProperty.Generator/) [![GitHub issues](https://img.shields.io/github/issues/rrmanzano/maui-bindableproperty-generator?style=flat-square)](https://github.com/rrmanzano/maui-bindableproperty-generator/) [![GitHub stars](https://img.shields.io/github/stars/rrmanzano/maui-bindableproperty-generator?style=flat-square)](https://github.com/rrmanzano/maui-bindableproperty-generator/stargazers) ![last commit](https://img.shields.io/github/last-commit/rrmanzano/maui-bindableproperty-generator?style=flat-square)\n\n# Maui.BindableProperty.Generator\n\nSource generator that automatically transforms fields into BindableProperties that can be used in MAUI.  \nAre you looking for the Xamarin project? check this [link](https://github.com/rrmanzano/xamarin-bindableproperty-generator)\n\n## Installation\nFirst, [install NuGet](http://docs.nuget.org/docs/start-here/installing-nuget). Then, install [M.BindableProperty.Generator](https://www.nuget.org/packages/M.BindableProperty.Generator/) from the package manager console:\n````bash\nPM\u003e Install-Package M.BindableProperty.Generator\n````\n\n## Usage - Simple implementation\nJust decorate the field with the Bindable attribute.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable]\n        private readonly string _placeholder;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty PlaceholderProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(Placeholder),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __PlaceholderChanged,\n                                                                propertyChanging: __PlaceholderChanging);\n\n        public string Placeholder\n        {\n            get =\u003e (string)GetValue(PlaceholderProperty);\n            set =\u003e SetValue(PlaceholderProperty, value);\n        }\n\n        private static void __PlaceholderChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.OnPlaceholderChanged((string)newValue);\n        }\n\n        partial void OnPlaceholderChanged(string value);\n\n        private static void __PlaceholderChanging(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.OnPlaceholderChanging((string)newValue);\n        }\n\n        partial void OnPlaceholderChanging(string value);\n    }\n```\n\n## Options\n\n| Option                    | Description                    | Type                             |\n| -------------             | ------------------------------ | ------------------------------   |\n| `PropertyName`            | Specifies the prefix used to create the BindableProperty, if `PropertyName` is null, then will take the name of the field removing the underscores and using PascalCase. Example: `_tex_t` will be transformed to `Text`. | `string`                         |\n| `OnChanged`               | Specifies the name of the method to be executed when the property changes, if not specified, will generate a partial method that will be notified when the property changed. | `string`                         |\n| `OnChanging`              | Specifies the name of the method to be executed when the property is changing, if not specified, will generate a partial method that will be notified when the property is changing. | `string`                         |\n| `DefaultValue`            | Specifies the \"text/value\" that will be used as default. Example: `default(string)`| `string`                         |\n| `DefaultBindingMode`      | Specifies the \"BindingMode\" as string that will be used as default.  Options: `Default/TwoWay/OneWay/OneWayToSource/OneTime`.  Example: `nameof(BindingMode.TwoWay)`| `string`                         |\n| `HidesUnderlyingProperty` | Specifies if the BindingProperty will hide the current implementation.       | `bool`                           |\n| `ValidateValue`           | Specifies the name of the method to be executed to validate the values.       | `string`                         |\n| `PropertyAccessibility`   | Specifies the property accessibility, if no parameter is specified, what is defined in the class will be used, Options: `Private/ProtectedAndInternal/Protected/Internal/ProtectedOrInternal/Public`. Example: `BindablePropertyAccessibility.ProtectedOrInternal`       | `BindablePropertyAccessibility`                         |\n\n## Usage - **PropertyName**\nJust decorate the field with the Bindable attribute.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(PropertyName = \"LastName\")]\n        private readonly? string _l;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty LastNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(LastName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string?),\n                                                                propertyChanged: __LastNameChanged,\n                                                                propertyChanging: __LastNameChanging);\n\n        public string? LastName\n        {\n            get =\u003e (string?)GetValue(LastNameProperty);\n            set =\u003e SetValue(LastNameProperty, value);\n        }\n\n        ... \n    }\n```\n\n## Usage - **OnChanged**\n\n### Example 1 - No Parameters\nJust decorate the field with the Bindable attribute.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(OnChanged = nameof(UpdateDisplayName))]\n        private readonly string _firstName;\n\n        private void UpdateDisplayName()\n        { \n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        private static void __FirstNameChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.UpdateDisplayName();\n        }\n\n        ...\n    }\n```\n\n### Example 2 - One Parameter\nJust decorate the field with the Bindable attribute. The 'UpdateDisplayName' method must have only one parameter (must match the type of the field)\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(OnChanged = nameof(UpdateDisplayName))]\n        private readonly string _firstName;\n\n        private void UpdateDisplayName(string newValue)\n        { \n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        private static void __FirstNameChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.UpdateDisplayName((string)newValue);\n        }\n\n        ...\n    }\n```\n\n### Example 3 - Two Parameters\nJust decorate the field with the Bindable attribute. The 'UpdateDisplayName' method must have two parameters (must match the type of the field)\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(OnChanged = nameof(UpdateDisplayName))]\n        private readonly string _firstName;\n\n        private void UpdateDisplayName(string oldValue, string newValue)\n        { \n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        private static void __FirstNameChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.UpdateDisplayName((string)oldValue, (string)newValue);\n        }\n\n        ...\n    }\n```\n\n### Example 4 - Partial method\nJust decorate the field with the Bindable attribute and by default will generated a partial method\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable()]\n        private readonly string _firstName;\n\n        partial void OnFirstNameChanged(string value)\n        {\n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        private static void __FirstNameChanged(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.OnFirstNameChanged((string)newValue);\n        }\n\n        partial void OnFirstNameChanged(string value);\n\n        ...\n    }\n```\n\n## Usage - **OnChanging**\n\n### Example 1\nJust decorate the field with the Bindable attribute.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(OnChanging = nameof(UpdateDisplayNameBeforeChange))]\n        private readonly string _firstName = string.Empty;\n\n        private void UpdateDisplayNameBeforeChange()\n        {\n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        ...\n\n        private static void __FirstNameChanging(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.UpdateDisplayNameBeforeChange();\n        }\n\n        ...\n    }\n```\n\n### Example 2 - Partial method\nJust decorate the field with the Bindable attribute.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable()]\n        private readonly string _firstName = string.Empty;\n\n        partial void OnFirstNameChanging(string value)\n        {\n            // Do stuff here\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        ...\n        \n        private static void __FirstNameChanging(Microsoft.Maui.Controls.BindableObject bindable, object oldValue, object newValue)\n        {\n            var ctrl = (HeaderControl)bindable;\n            ctrl.OnFirstNameChanging((string)newValue);\n        }\n\n        partial void OnFirstNameChanging(string value);\n\n        ...\n    }\n```\n\n## Usage - **DefaultValue**\n\n### Example 1 - DateTime\nJust decorate the field with the Bindable attribute and add the \"text/value\" that you want to use as default value.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(DefaultValue = \"DateTime.Now\")]\n        private readonly DateTime _birthDate;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty BirthDateProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(BirthDate),\n                                                                typeof(DateTime?),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: DateTime.Now,\n                                                                propertyChanged: __BirthDateChanged,\n                                                                propertyChanging: __BirthDateChanging);\n\n        public System.DateTime BirthDate\n        {\n            get =\u003e (System.DateTime)GetValue(BirthDateProperty);\n            set =\u003e SetValue(BirthDateProperty, value);\n        }\n        \n        ...\n    }\n```\n\n### Example 2 - String\nJust decorate the field with the Bindable attribute and add the \"text/value\" that you want to use as default value.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(DefaultValue = \"USA\")]\n        private readonly string _country;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty CountryProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(Country),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: \"USA\",\n                                                                propertyChanged: __CountryChanged,\n                                                                propertyChanging: __CountryChanging);\n\n        public string Country\n        {\n            get =\u003e (string)GetValue(CountryProperty);\n            set =\u003e SetValue(CountryProperty, value);\n        }\n\n        ...\n    }\n```\n\n## Usage - **DefaultBindingMode**\nJust decorate the field with the Bindable attribute and add the \"BindingMode\" that you want to use as default value.\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(DefaultBindingMode = nameof(BindingMode.TwoWay))]\n        private readonly string _firstName;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty FirstNameProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(FirstName),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string),\n                                                                propertyChanged: __FirstNameChanged,\n                                                                propertyChanging: __FirstNameChanging,\n                                                                defaultBindingMode: Microsoft.Maui.Controls.BindingMode.TwoWay);\n\n        public string FirstName\n        {\n            get =\u003e (string)GetValue(FirstNameProperty);\n            set =\u003e SetValue(FirstNameProperty, value);\n        }\n\n        ...\n    }\n```\n\n## Usage - **HidesUnderlyingProperty**\nJust decorate the field with the Bindable attribute and set \"HidesUnderlyingProperty = true\".\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(HidesUnderlyingProperty = true, DefaultValue = \"Color.FromArgb(\\\"#cc3340\\\")\")]\n        private readonly Color? _backgroundColor;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static new readonly Microsoft.Maui.Controls.BindableProperty BackgroundColorProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(BackgroundColor),\n                                                                typeof(Color?),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: Color.FromArgb(\"#cc3340\"),\n                                                                propertyChanged: __BackgroundColorChanged,\n                                                                propertyChanging: __BackgroundColorChanging);\n\n        public new Color? BackgroundColor\n        {\n            get =\u003e (Color?)GetValue(BackgroundColorProperty);\n            set =\u003e SetValue(BackgroundColorProperty, value);\n        }\n\n        ...\n    }\n```\n\n## Usage - **ValidateValue**\n### Example 1 - Non-Static Method\nJust decorate the field with the Bindable attribute. The 'ValidateNotNull' method must have two parameters (one of type BindableObject and the second one must be the same as the field)\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(ValidateValue = nameof(ValidateIsNullOrEmpty))]\n        private readonly string? _country;\n\n        private bool ValidateIsNullOrEmpty(BindableObject _, string? value)\n        {\n            // Do stuff here\n            return !string.IsNullOrEmpty(value);\n        }\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty CountryProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(Country),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string?),\n                                                                propertyChanged: __CountryChanged,\n                                                                propertyChanging: __CountryChanging,\n                                                                validateValue: __ValidateIsNullOrEmpty);\n\n        public string? Country\n        {\n            get =\u003e (string?)GetValue(CountryProperty);\n            set =\u003e SetValue(CountryProperty, value);\n        }\n\n        private static bool __ValidateIsNullOrEmpty(Microsoft.Maui.Controls.BindableObject bindable, object value)\n        {\n            var ctrl = (HeaderControl)bindable;\n            return ctrl.ValidateIsNullOrEmpty(ctrl, (string?)value);\n        }\n\n        ...\n    }\n```\n### Example 2 - Static Method\nJust decorate the field with the Bindable attribute. The 'ValidateNotNull' method must have two parameters (one of type BindableObject and the second one must be object type)\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(ValidateValue = nameof(ValidateNotNull))]\n        private readonly string? _zipCode;\n\n        private static bool ValidateNotNull(BindableObject _, object value) =\u003e value != null;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        public static readonly Microsoft.Maui.Controls.BindableProperty ZipCodeProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(ZipCode),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string?),\n                                                                propertyChanged: __ZipCodeChanged,\n                                                                propertyChanging: __ZipCodeChanging,\n                                                                validateValue: ValidateNotNull);\n\n        public string? ZipCode\n        {\n            get =\u003e (string?)GetValue(ZipCodeProperty);\n            set =\u003e SetValue(ZipCodeProperty, value);\n        }\n        \n        ...\n    }\n```\n\n## Usage - **PropertyAccessibility**\nJust decorate the field with the Bindable attribute and set \"PropertyAccessibility = Private/ProtectedAndInternal/Protected/Internal/ProtectedOrInternal/Public\".\n\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        [AutoBindable(PropertyAccessibility = BindablePropertyAccessibility.ProtectedOrInternal)]\n        private readonly string? _age;\n    }\n```\nthe prevoius code will generate this:\n```csharp\n    public partial class HeaderControl\n    {\n        protected internal static readonly Microsoft.Maui.Controls.BindableProperty AgeProperty =\n                                        Microsoft.Maui.Controls.BindableProperty.Create(\n                                                                nameof(Age),\n                                                                typeof(string),\n                                                                typeof(HeaderControl),\n                                                                defaultValue: default(string?),\n                                                                propertyChanged: __AgeChanged,\n                                                                propertyChanging: __AgeChanging);\n\n        protected internal string? Age\n        {\n            get =\u003e (string?)GetValue(AgeProperty);\n            set =\u003e SetValue(AgeProperty, value);\n        }\n\n        ...\n    }\n```\n\n## Do you want to remove the compiler warning CS0169 ?\n```csharp\n    using Maui.BindableProperty.Generator.Core;\n\n    public partial class HeaderControl : ContentView\n    {\n        #pragma warning disable CS0169\n\n        [AutoBindable]\n        private readonly string? _country;\n\n        #pragma warning restore CS0169\n    }\n```\n\n## Project status\n\n- ✅ `PropertyName` - Done\n- ✅ `OnChanged` - Done\n- ✅ `OnChanging` - Done\n- ✅ `DefaultValue` - Done\n- ✅ `DefaultBindingMode` - Done\n- ✅ `HidesUnderlyingProperty` - Done\n- ✅ `ValidateValue` - Done\n- ✅ `PropertyAccessibility` - Done\n- 🔳 Allow nested class - In Progress\n- 🔳 Add Attributes Property - Pending\n\n\n## Extra info\nThis repo is using part of the code of [CodeWriter](https://github.com/SaladLab/CodeWriter \"CodeWriter\") to generate the CSharp files, thanks to the author.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrmanzano%2Fmaui-bindableproperty-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrmanzano%2Fmaui-bindableproperty-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrmanzano%2Fmaui-bindableproperty-generator/lists"}