Getting Started with ComboBox for Xamarin
This article will guide you through the steps needed to add a basic RadComboBox control in your application.
- Setting up the app
- Adding the required Telerik references
- Adding RadComboBox control
- Populating RadComboBox control with data
1. Setting up the app
Take a look at these articles and follow the instructions to setup your app:
2. Adding the required Telerik references
You have two options:
- Add the Telerik UI for Xamarin Nuget package following the instructions in Telerik NuGet package server topic.
If you don't want to add the all Telerik.UI.for.Xamarin nuget package, you have the option to add a separate nuget package. For RadComboBox control you have to install the Telerik.UI.for.Xamarin.Input nuget package. This nuget will automatically refer the Telerik.UI.for.Xamarin.DataControls and Telerik.UI.for.Xamarin.Primitives nuget packages.
- Add the references to Telerik assemblies manually, check the list below with the required assemblies for RadComboBox component:
Platform | Assemblies |
---|---|
Portable | Telerik.XamarinForms.Input.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.DataControls.dll Telerik.XamarinForms.Primitives.dll |
Android | Telerik.XamarinForms.Input.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.DataControls.dll Telerik.Xamarin.Android.Primitives.dll Telerik.XamarinForms.Primitives.dll |
iOS | Telerik.Xamarin.iOS.dllTelerik.XamarinForms.Input.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.DataControls.dll Telerik.XamarinForms.Primitives.dll |
UWP | Telerik.Core.dll Telerik.UI.Xaml.Primitives.UWP.dll Telerik.XamarinForms.Input.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.DataControls.dll Telerik.XamarinForms.Primitives.dll |
3. Adding RadComboBox control
You could use one of the following approaches:
Drag the control from the Toolbox.
Take a look at the following topics on how to use the toolbox:
Create the control definition in XAML or C#.
The snippet below shows a simple RadCheckBox definition:
In addition to this, you need to add the following namespace:
4. Populating RadComboBox control with data
Using static data
Here is the result:
Binding to a complex object
Here is the ComboBox definition in XAML and in code behind:
When binding to a complex objects, ComboBox DisplayMemberPath property should be set.
the sample business model
and the ViewModel used:
Here is the result:
The Getting Started example can be found in our SDK Browser Application. You can find the applications in the Examples folder of your local Telerik UI for Xamarin installation or in the following GitHub repo.