{"id":13629498,"url":"https://github.com/notanaverageman/Bindables","last_synced_at":"2025-04-17T09:34:15.141Z","repository":{"id":40722221,"uuid":"71723579","full_name":"notanaverageman/Bindables","owner":"notanaverageman","description":"Bindables converts your auto properties into Wpf dependency or attached properties.","archived":false,"fork":false,"pushed_at":"2023-11-14T17:08:13.000Z","size":241,"stargazers_count":53,"open_issues_count":3,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T13:18:06.928Z","etag":null,"topics":["attached-properties","c-sharp","dependency-properties","fody","wpf","wpf-dependency"],"latest_commit_sha":null,"homepage":"","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/notanaverageman.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-23T19:10:04.000Z","updated_at":"2024-11-24T18:50:04.000Z","dependencies_parsed_at":"2023-11-14T17:40:19.047Z","dependency_job_id":"a3d69cb0-7b77-4d8a-85ce-da48afc380ed","html_url":"https://github.com/notanaverageman/Bindables","commit_stats":{"total_commits":81,"total_committers":4,"mean_commits":20.25,"dds":"0.41975308641975306","last_synced_commit":"6fa225442a90092b704ef916dfefb885bf908669"},"previous_names":["yusuf-gunaydin/bindables"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notanaverageman%2FBindables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notanaverageman%2FBindables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notanaverageman%2FBindables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notanaverageman%2FBindables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notanaverageman","download_url":"https://codeload.github.com/notanaverageman/Bindables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986583,"owners_count":21194077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["attached-properties","c-sharp","dependency-properties","fody","wpf","wpf-dependency"],"created_at":"2024-08-01T22:01:12.146Z","updated_at":"2025-04-17T09:34:14.860Z","avatar_url":"https://github.com/notanaverageman.png","language":"C#","funding_links":[],"categories":["Contributors Welcome for those"],"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"],"readme":"\n# Roslyn source generator to create dependency and attached properties for WPF, Xamarin.Forms, and .NET MAUI\n\n[![NuGet Bindables.Wpf](https://img.shields.io/nuget/v/Bindables.Wpf.svg?label=Bindables.Wpf)](https://www.nuget.org/packages/Bindables.Wpf/)\n[![NuGet Bindables.Forms](https://img.shields.io/nuget/v/Bindables.Forms.svg?label=Bindables.Forms)](https://www.nuget.org/packages/Bindables.Forms/)\n[![NuGet Bindables.Forms](https://img.shields.io/nuget/v/Bindables.Maui.svg?label=Bindables.Maui)](https://www.nuget.org/packages/Bindables.Maui/)\n[![AppVeyor](https://img.shields.io/appveyor/ci/notanaverageman/bindables.svg)](https://ci.appveyor.com/project/notanaverageman/bindables)\n\n## Requirements\n\n- Your class should be `partial`.\n- If you create a dependency property (WPF) or bindable property (Xamarin.Forms \u0026 .NET MAUI), your class should inherit from `System.Windows.DependencyObject` or `Xamarin.Forms.BindableObject` or `Microsoft.Maui.Controls.BindableObject` according to the project type. Attached properties don't have this requirement.\n- Bindables creates the static constructor for the class to initialize the dependency properties. If you have custom static constructor for a type, you can't use Bindables on it.\n\n## Example (WPF)\n\nCheck [Types for Frameworks](#types-for-frameworks) for other frameworks.\n\n### Your Code\n\n```c#\nusing System.Windows;\nusing Bindables.Wpf;\n\npublic partial class YourClass : DependencyObject\n{\n    private static readonly string DefaultValue = \"Test\";\n\n    [DependencyProperty(typeof(string))]\n    public static readonly DependencyProperty RegularProperty;\n\n    // You can use any visibility modifier.\n    [DependencyProperty(typeof(string))]\n    private static readonly DependencyPropertyKey ReadOnlyPropertyKey;\n\n    [DependencyProperty(typeof(string), OnPropertyChanged = nameof(PropertyChangedCallback), DefaultValueField = nameof(DefaultValue), Options = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)]\n    public static readonly DependencyProperty CustomizedProperty;\n\n    private static void PropertyChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)\n    {\n    }\n}\n```\n\n### Generated Code\n\n```c#\n// Generated by Bindables\nusing System.Windows;\n\n#nullable enable\n\npublic partial class YourClass\n{\n    [global::System.CodeDom.Compiler.GeneratedCode(\"Bindables.Wpf.WpfPropertyGenerator\", \"1.4.1\")]\n    public string? Regular\n    {\n        get =\u003e (string?)GetValue(RegularProperty);\n        set =\u003e SetValue(RegularProperty, value);\n    }\n\n    [global::System.CodeDom.Compiler.GeneratedCode(\"Bindables.Wpf.WpfPropertyGenerator\", \"1.4.1\")]\n    public static readonly DependencyProperty ReadOnlyProperty;\n\n    [global::System.CodeDom.Compiler.GeneratedCode(\"Bindables.Wpf.WpfPropertyGenerator\", \"1.4.1\")]\n    public string? ReadOnly\n    {\n        get =\u003e (string?)GetValue(ReadOnlyProperty);\n        private set =\u003e SetValue(ReadOnlyPropertyKey, value);\n    }\n\n    [global::System.CodeDom.Compiler.GeneratedCode(\"Bindables.Wpf.WpfPropertyGenerator\", \"1.4.1\")]\n    public string? Customized\n    {\n        get =\u003e (string?)GetValue(CustomizedProperty);\n        set =\u003e SetValue(CustomizedProperty, value);\n    }\n\n    [global::System.CodeDom.Compiler.GeneratedCode(\"Bindables.Wpf.WpfPropertyGenerator\", \"1.4.1\")]\n    static YourClass()\n    {\n        RegularProperty = DependencyProperty.Register(\n            nameof(Regular),\n            typeof(string),\n            typeof(YourClass),\n            new FrameworkPropertyMetadata());\n\n        ReadOnlyPropertyKey = DependencyProperty.RegisterReadOnly(\n            nameof(ReadOnly),\n            typeof(string),\n            typeof(YourClass),\n            new FrameworkPropertyMetadata());\n\n        ReadOnlyProperty = ReadOnlyPropertyKey.DependencyProperty;\n\n        CustomizedProperty = DependencyProperty.Register(\n            nameof(Customized),\n            typeof(string),\n            typeof(YourClass),\n            new FrameworkPropertyMetadata(DefaultValue, (FrameworkPropertyMetadataOptions)256, PropertyChangedCallback));\n    }\n}\n```\n\n## Options\n\nYou can pass following options:\n\n|Option                       | Description                                                                       |\n|-----------------------------|-----------------------------------------------------------------------------------|\n|`OnPropertyChanged`          | Name of the method that will be called when the property is changed.              |\n|`OnCoerceValue` (WPF)        | Name of the method that will be called when the property is re-evaluated/coerced. |\n|`DefaultValueField`          | Name of the static field that will provide the default value for the property.    |\n|`Options` (WPF)              | Pass `System.Windows.FrameworkPropertyMetadataOptions` to the dependency property.|\n|`BindingMode` (Xamarin.Forms)| Pass `Xamarin.Forms.BindingMode` to the dependency property.                      |\n|`BindingMode` (.NET MAUI)    | Pass `Microsoft.Maui.Controls.BindingMode` to the dependency property.            |\n\nSignature of `OnPropertyChanged` method should be:\n|Project Type             |Signature                                                                              |\n|-------------------------|---------------------------------------------------------------------------------------|\n|WPF                      |`static void MethodName(DependencyObject obj, DependencyPropertyChangedEventArgs args)`|\n|Xamarin.Forms \u0026 .NET MAUI|`static void MethodName(BindableObject obj, object oldValue, object newValue)`         |\n\nSignature of `OnCoerceValue` method should be:\n|Project Type             |Signature                                                     |\n|-------------------------|--------------------------------------------------------------|\n|WPF                      |`static object MethodName(DependencyObject obj, object value)`|\n|Xamarin.Forms \u0026 .NET MAUI|`static object MethodName(BindableObject obj, object value)`  |\n\n## Types for Frameworks\n\n|Project Type |Dependency Property Type|Access Type|Property Suffix|Field Type             |Attribute Type                             |\n|-------------|------------------------|-----------|---------------|-----------------------|-------------------------------------------|\n|WPF          |Dependency Property     |Read/Write |`Property`     |`DependencyProperty`   |`Bindables.Wpf.DependencyPropertyAttribute`|\n|WPF          |Dependency Property     |Read Only  |`PropertyKey`  |`DependencyPropertyKey`|`Bindables.Wpf.DependencyPropertyAttribute`|\n|WPF          |Attached Property       |Read/Write |`Property`     |`DependencyProperty`   |`Bindables.Wpf.AttachedPropertyAttribute`  |\n|WPF          |Attached Property       |Read Only  |`PropertyKey`  |`DependencyPropertyKey`|`Bindables.Wpf.AttachedPropertyAttribute`  |\n|Xamarin.Forms|Bindable Property       |Read/Write |`Property`     |`BindableProperty`     |`Bindables.Forms.BindablePropertyAttribute`|\n|Xamarin.Forms|Bindable Property       |Read Only  |`PropertyKey`  |`BindablePropertyKey`  |`Bindables.Forms.BindablePropertyAttribute`|\n|Xamarin.Forms|Attached Property       |Read/Write |`Property`     |`BindableProperty`     |`Bindables.Forms.AttachedPropertyAttribute`|\n|Xamarin.Forms|Attached Property       |Read Only  |`PropertyKey`  |`BindablePropertyKey`  |`Bindables.Forms.AttachedPropertyAttribute`|\n|.NET MAUI    |Bindable Property       |Read/Write |`Property`     |`BindableProperty`     |`Bindables.Maui.BindablePropertyAttribute` |\n|.NET MAUI    |Bindable Property       |Read Only  |`PropertyKey`  |`BindablePropertyKey`  |`Bindables.Maui.BindablePropertyAttribute` |\n|.NET MAUI    |Attached Property       |Read/Write |`Property`     |`BindableProperty`     |`Bindables.Maui.AttachedPropertyAttribute` |\n|.NET MAUI    |Attached Property       |Read Only  |`PropertyKey`  |`BindablePropertyKey`  |`Bindables.Maui.AttachedPropertyAttribute` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotanaverageman%2FBindables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotanaverageman%2FBindables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotanaverageman%2FBindables/lists"}