{"id":13710983,"url":"https://github.com/patrickabadi/AutoForms","last_synced_at":"2025-05-06T20:31:23.014Z","repository":{"id":143396754,"uuid":"296752421","full_name":"patrickabadi/AutoForms","owner":"patrickabadi","description":"Auto generated Xamarin.Forms UI from your Domain Models","archived":false,"fork":false,"pushed_at":"2021-03-12T22:04:32.000Z","size":1238,"stargazers_count":24,"open_issues_count":0,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-13T21:44:45.380Z","etag":null,"topics":["android","csharp","domain-driven-design","generative-model","ios","uwp","xamarin","xamarin-binding","xamarin-forms","xamarin-library","xamarin-plugin","xamarinforms","xaml"],"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/patrickabadi.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":"2020-09-18T23:54:20.000Z","updated_at":"2024-09-26T22:26:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d5139e4-8ccf-4363-a61a-b1c4d51eaf80","html_url":"https://github.com/patrickabadi/AutoForms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickabadi%2FAutoForms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickabadi%2FAutoForms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickabadi%2FAutoForms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickabadi%2FAutoForms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickabadi","download_url":"https://codeload.github.com/patrickabadi/AutoForms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252764280,"owners_count":21800666,"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":["android","csharp","domain-driven-design","generative-model","ios","uwp","xamarin","xamarin-binding","xamarin-forms","xamarin-library","xamarin-plugin","xamarinforms","xaml"],"created_at":"2024-08-02T23:01:03.042Z","updated_at":"2025-05-06T20:31:23.007Z","avatar_url":"https://github.com/patrickabadi.png","language":"C#","funding_links":[],"categories":["UI"],"sub_categories":[],"readme":"**AutoForms** is a Xamarin.Forms control that can dynamically generate UI powered by the data model you give it.\n\nTo use **AutoForms** simply add the control in your xaml and then bind it to your data model.  On your model you add certain attributes to each property telling AutoForms how it should behave.\n\n## Supported platforms\n\n- [x] Android\n- [x] iOS\n- [x] UWP\n- [?] Other Platforms (Should work but I haven't tested)\n\n## Example\n**xaml**\n```xml\n\u003cAutoForms LabelStyle=\"{StaticResource DefaultLabelStyle}\"/\u003e\n```\n\n**C#**\n```cs\npublic class HelloModel\n    {\n        public enum Relation\n        {\n            [Description(\"Parent\")]\n            Parent,\n            [Description(\"Child\")]\n            Child,\n            [Description(\"Grandparent\")]\n            Grandparent,\n            [Description(\"No Relation\")]\n            NoRelation\n        }\n\n        [AutoForms(\"First Name\")]\n        public string Firstname { get; set; }\n\n        [AutoForms(\"Last Name\")]\n        public string Lastname { get; set; }\n\n        [AutoForms(\"Date of Birth\")]\n        public DateTime DOB { get; set; }\n\n        [AutoForms(\"Relation\")]\n        public Relation RelationToClient { get; set; }\n    }\n```\n\n|       |  |\n| ----------- | ----------- |\n| \u003cimg src=\"./Screenshots/helloworld-uwp.png\" width=\"400\" /\u003e     | \u003cimg src=\"./Screenshots/helloworld-android.png\" width=\"400\" /\u003e       |\n| UWP      | Android |\n\n## Horizontal grouping controls\nControls can be displayed in a horizontal grouping\n```cs\n[AutoFormsHorizontalGroup(3, GridUnitType.Star)]\n[AutoForms(\"Phone Number\", AutoFormsType.Entry, grouped: new string[] { nameof(Phone) })]\npublic string PhoneNumber { get; set; }\n\n[AutoFormsHorizontalGroup(1, GridUnitType.Star)]\n[AutoForms(\" \")]\npublic PhoneType Phone { get; set; }\n\n```\n\u003cimg src=\"./Screenshots/horizontal-android.png\" width=\"400\"/\u003e\n\n## More Controls\nThere are many more controls than listed here.  Check the sample application to view them all\n```cs\n[AutoForms(\"Click Me\", itemStyle:\"DefaultButtonStyle\")]\npublic ICommand MyButton { get; set; }\n\n[AutoForms(\"Checkbox\")]\npublic bool Check { get; set; }\n\npublic enum EnumRadioType { One, Two }\n\n[AutoFormsRadioButton(\"Radio buttons\", AutoFormsOrientation.Horizontal)]\npublic EnumRadioType? MyRadioEnum { get; set; }\n\npublic enum EnumType { First, Second, Third }\n\n[AutoForms(\"Select Buttons\", AutoFormsType.SelectButton, itemStyle: \"DefaultSelectButtonStyle\")]\npublic EnumType? MySelectButton { get; set; }\n```\n\u003cimg src=\"./Screenshots/controls-android.png\" width=\"400\" /\u003e \n\n## Lists\nGrowing lists of items can be included in your forms\n\n```cs\n[AutoFormsList(\"Policy Numbers\",\n            commands: new string[] { nameof(AddPolicyCommand) },\n            emptyListMessage: \"No policy numbers have been entered yet. Add one above.\",\n            nestedListView: true)]\npublic ObservableCollection\u003cPolicyNumber\u003e PolicyNumbers { get; set; }\n```\n\n\u003cimg src=\"./Screenshots/lists-android.png\" width=\"400\" /\u003e \n\n## Validation\nThere is both active validation on supported properties as well as the ability to query the validation states\n\n```cs\npublic class ValidationModel\n    {\n        public AutoFormsValidation AutoFormsValidation { get; set; }\n\n        [AutoForms(\"Name\")]\n        [AutoFormsRequired]\n        [AutoFormsMaxLength(10)]\n        public string Name { get; set; }\n\n        [AutoForms(\"Email\")]\n        [AutoFormsRequired]\n        [AutoFormsMaxLength(10)]\n        [AutoFormsEmail]\n        public string Email { get; set; }\n\n        [AutoFormsHorizontalGroup(1, GridUnitType.Star)]\n        [AutoForms(\" \", AutoFormsType.Entry, placeholder: \"CC\", grouped: new string[] { nameof(PhoneNumber), nameof(Extension) })]\n        [AutoFormsMaxLength(5)]\n        [AutoFormsRequired]\n        public string CountryCode { get; set; }\n\n        [AutoFormsHorizontalGroup(3, GridUnitType.Star)]\n        [AutoForms(\" \", AutoFormsType.Entry, placeholder:\"Number\")]\n        [AutoFormsMaxLength(10)]\n        [AutoFormsMinLength(5)]\n        [AutoFormsRequired]\n        public string PhoneNumber { get; set; }\n\n        [AutoFormsHorizontalGroup(1, GridUnitType.Star)]\n        [AutoForms(\" \", AutoFormsType.Entry, placeholder:\"Ext\")]\n        [AutoFormsMaxLength(4)]        \n        [AutoFormsRequired]\n        public string Extension { get; set; }\n    }\n```\n\n \u003cimg src=\"./Screenshots/validation.png\" width=\"400\" /\u003e\n\n## Filtering\n\nThe same model can be used to show multiple generated UI for different scenarios.\n```cs \npublic class FilteringModel\n{\n    public enum FilterType\n    {\n        Login = 1 \u003c\u003c 0,\n        Create = 1 \u003c\u003c 1,\n    }\n\n    public string FilteringType =\u003e typeof(FilterType).FullName;\n    public string Filter { get; set; }\n\n    [AutoForms(\"Login\", \n        horizontalLabelOptions: AutoFormsLayoutOptions.Center, \n        paddingTop: 40,\n        filter: (int)(FilterType.Login))]\n    public object LabelLogin { get; set; }\n\n    [AutoForms(\"Create\", \n        horizontalLabelOptions: AutoFormsLayoutOptions.Center,\n        paddingTop: 40,\n        filter: (int)(FilterType.Create))]\n    public object LabelCreate { get; set; }\n\n    [AutoFormsHorizontalGroup(1, GridUnitType.Star, filter: (int)(FilterType.Create))]\n    [AutoForms(\"Name\", placeholder: \"First\", filter: (int)(FilterType.Create), grouped: new string[] { nameof(LastName) })]\n    public string FirstName { get; set; }\n\n    [AutoFormsHorizontalGroup(1, GridUnitType.Star, filter: (int)(FilterType.Create))]\n    [AutoForms(\" \", placeholder: \"Last\", filter: (int)(FilterType.Create))]\n    public string LastName { get; set; }\n\n    [AutoForms(\" \", placeholder:\"Email\", filter:(int)(FilterType.Create | FilterType.Login))]\n    public string Email { get; set; }\n\n    [AutoForms(\" \", placeholder: \"Password\", filter: (int)(FilterType.Create | FilterType.Login))]\n    public string Password { get; set; }\n\n    [AutoForms(\"Login\", itemStyle: \"DefaultButtonStyle\", filter: (int)(FilterType.Login))]\n    public ICommand LoginCommand { get; set; }\n\n    [AutoForms(\"Create\", itemStyle: \"DefaultButtonStyle\", filter: (int)(FilterType.Create))]\n    public ICommand CreateCommand { get; set; }\n\n}\n```\n *Note: the top tab control is a separate control, not generated by AutoForms.\n\n \u003cimg src=\"./Screenshots/filtering.gif\" width=\"400\" /\u003e \n\n## Localization\nIn order to get localization working there are a few steps you need to take. First create your localization resx files and place them in your project.  Next tell AutoForms where the Assemblies are located (your app and also the folder where the resources are kept).  Note that if AutoForms does not find the localization it will revert to the string it was given. \n```cs\n// Resource string\nAutoFormsConstants.ApplicationPath = \"AutoForms.Test\";\nAutoFormsConstants.StringResourcePath = \"AutoForms.Test.Resources.Resource\";\nAutoFormsConstants.CultureOverride = null; // optional\n```\nHere is an example localized model:\n```cs\npublic class LocalizationModel\n{\n    [AutoForms(\"IDS_DATE_Days\")]\n    public string Days { get; set; }\n\n    [AutoForms(\"IDS_DATE_Week\")]\n    public string Week { get; set; }\n\n    [AutoForms(\"IDS_DATE_Hours\")]\n    public string Hours { get; set; }\n\n    [AutoForms(\"IDS_DATE_Min\")]\n    public string Min { get; set; }\n\n    [AutoForms(\"IDS_DATE_Sec\")]\n    public string Sec { get; set; }\n}\n```\n|       |  |\n| ----------- | ----------- |\n| \u003cimg src=\"./Screenshots/localization-resource.png\" width=\"400\" /\u003e     | \u003cimg src=\"./Screenshots/localization-android.png\" width=\"400\" /\u003e       |\n\n ## AutoFormsConstants\n This is a static configuration class where you can specifiy certain UX and styling variables used by AutoForms.  There are several controls that require the use of an Icon font (Radio,Checkbox,List Action), which if used, would be needed to be included into your project.  Have a look at the sample application how the Material Icon font was included with the project (App.xaml.cs).\n\n ## Contributions\n All comments, suggestions, programming help is fully welcome.\n\n## Todo\n- ~~Localization for all labels~~\n- More data types and controls\n- More configuration options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickabadi%2FAutoForms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickabadi%2FAutoForms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickabadi%2FAutoForms/lists"}