{"id":23061571,"url":"https://github.com/syncfusionexamples/integrate-.net-maui-picker-with-android-native-embedding","last_synced_at":"2026-05-07T07:37:50.321Z","repository":{"id":234148881,"uuid":"786880491","full_name":"SyncfusionExamples/Integrate-.NET-MAUI-Picker-with-android-native-embedding","owner":"SyncfusionExamples","description":"This repository contains a sample that explain how to integrate .NET MAUI SfPicker with android native embedding.","archived":false,"fork":false,"pushed_at":"2024-04-18T07:15:57.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T20:48:26.842Z","etag":null,"topics":["android","dotnet-maui","editor","native-embedding","picker","sfpicker"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SyncfusionExamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-04-15T13:31:25.000Z","updated_at":"2024-04-18T07:31:44.000Z","dependencies_parsed_at":"2024-04-18T10:23:15.590Z","dependency_job_id":"f7d54e63-3394-4cbf-a8d4-1478980d03d5","html_url":"https://github.com/SyncfusionExamples/Integrate-.NET-MAUI-Picker-with-android-native-embedding","commit_stats":null,"previous_names":["syncfusionexamples/integrate-.net-maui-picker-with-android-native-embedding"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2FIntegrate-.NET-MAUI-Picker-with-android-native-embedding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2FIntegrate-.NET-MAUI-Picker-with-android-native-embedding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2FIntegrate-.NET-MAUI-Picker-with-android-native-embedding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2FIntegrate-.NET-MAUI-Picker-with-android-native-embedding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SyncfusionExamples","download_url":"https://codeload.github.com/SyncfusionExamples/Integrate-.NET-MAUI-Picker-with-android-native-embedding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246952280,"owners_count":20859813,"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","dotnet-maui","editor","native-embedding","picker","sfpicker"],"created_at":"2024-12-16T03:17:50.765Z","updated_at":"2026-05-07T07:37:50.294Z","avatar_url":"https://github.com/SyncfusionExamples.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to integrate .NET MAUI Picker (SfPicker) with android native embedding application\nIn this article, you will learn how to create a [.NET MAUI Picker](https://www.syncfusion.com/maui-controls/maui-picker) native embedded Android application by following the step by step process explained below.\n\n**Step 1:**\nCreate a .NET Android application and install the [Syncfusion.Maui.Picker](https://www.nuget.org/packages/Syncfusion.Maui.Picker) nuget package using the [nuget.org](https://www.nuget.org/).\n\n**Step 2:**\nIn the project file of the native application, add the tag `\u003cUseMaui\u003etrue\u003c/UseMaui\u003e` to enable the .NET MAUI support as demonstrated below.\n \n**[XML]:**\n ```xml\n\u003cPropertyGroup\u003e\n\t\u003cNullable\u003eenable\u003c/Nullable\u003e\n\t\u003cImplicitUsings\u003eenable\u003c/ImplicitUsings\u003e\n\t\u003cUseMaui\u003etrue\u003c/UseMaui\u003e\n\u003c/PropertyGroup\u003e\n ```\n \n**Step 3:**\nInitialize .NET MAUI in the native app project by creating a **MauiAppBuilder** object and using the **UseMauiEmbedding** function. Then, use the **Build()** method on the **MauiAppBuilder** object to build a **MauiApp** object. Finally, create a **MauiContext** object from the MauiApp object to convert .NET MAUI controls to native types.\n\n**[C#]:**\n ```csharp\nMauiContext? _mauiContext;\nprotected override void OnCreate(Bundle? savedInstanceState)\n{\n    base.OnCreate(savedInstanceState);\n    MauiAppBuilder builder = MauiApp.CreateBuilder();\n    builder.UseMauiEmbedding\u003cMicrosoft.Maui.Controls.Application\u003e();\n    builder.ConfigureSyncfusionCore();\n    MauiApp mauiApp = builder.Build();\n    _mauiContext = new MauiContext(mauiApp.Services, this);\n}\n ```\n \n**Step 4:**\nCreate a model class to manage the collection of data and provide customizable data source for the picker.\n \n**[C#]:**\n ```csharp\npublic class PickerModel\n{\n    private ObservableCollection\u003cobject\u003e dataSource = new ObservableCollection\u003cobject\u003e()\n    {\n        \"Pink\", \"Green\", \"Blue\", \"Yellow\", \"Orange\", \"Purple\", \"Sky Blue\", \"Pale Green\"\n    };\n\n    public ObservableCollection\u003cobject\u003e DataSource\n    {\n        get\n        {\n            return dataSource;\n        }\n        set\n        {\n            dataSource = value;\n        }\n    }\n\n    public PickerModel()\n    {\n\n    }\n}\n ```\n \n**Step 5:**\nCreate a view model class that initializes an instance of **PickerModel**.\n\n **[C#]:**\n ```csharp\npublic class PickerViewModel\n{\n    public PickerModel PickerModel { get; set; }\n    public PickerViewModel()\n    {\n        this.PickerModel = new PickerModel();\n    }\n}\n ```\n\n**Step 6:**\nConfigure the SfPicker by customizing the header with [PickerHeaderView](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Picker.PickerHeaderView.html) and bind the data source to the column with the [PickerColumn](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Picker.PickerColumn.html). To enable the HeaderView, set the [Height](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Picker.PickerHeaderView.html#Syncfusion_Maui_Picker_PickerHeaderView_HeightProperty) to the [PickerHeaderView](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Picker.PickerHeaderView.html). Follow the below code snippet for better understanding.\n \n**[C#]:**\n ```csharp\nprotected override void OnCreate(Bundle? savedInstanceState)\n{\n    PickerModel info = new PickerModel();\n    SfPicker picker = new SfPicker()\n    {\n        HeaderView = new PickerHeaderView()\n        {\n            Text = \"Select a color\",\n            Height = 60,\n            Background = Colors.Orange,\n        },\n\n        Columns = new ObservableCollection\u003cPickerColumn\u003e()\n        {\n            new PickerColumn()\n            {\n                HeaderText = \"Colors\",\n                ItemsSource = info.DataSource,\n                SelectedIndex = 4,\n            }\n        },\n    };  \n}\n ```\n\n**Step 7:**\nConvert the picker control to a platform-specific view for the MAUI framework and set this view as the content view for the current Android activity.\n\n **[C#]:**\n ```csharp\nprotected override void OnCreate(Bundle? savedInstanceState)\n{\n    Android.Views.View view = picker.ToPlatform(_mauiContext);\n\n    // Set our view from the \"main\" layout resource\n    SetContentView(view);\n}\n ```\n \n**Output:**\n\n![Picker.png](https://syncfusion.bolddesk.com/kb/agent/attachment/article/15082/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE4MDY4Iiwib3JnaWQiOiIzIiwiaXNzIjoic3luY2Z1c2lvbi5ib2xkZGVzay5jb20ifQ.lvpfVwiE6YqeAozIbXsxgrJfNciu3WodgD0mmIRCB_M)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fintegrate-.net-maui-picker-with-android-native-embedding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyncfusionexamples%2Fintegrate-.net-maui-picker-with-android-native-embedding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fintegrate-.net-maui-picker-with-android-native-embedding/lists"}