Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149881 | Dec 12,2019 08:07 PM UTC | Jul 10,2020 02:54 PM UTC | Xamarin.Forms | 4 |
![]() |
Tags: SfComboBox |
Hi Boris,
Greetings from Syncfusion.
We are currently working in the sample. We will update the
details by 17th December 2019.
Please let us know if you have any concern.
Regards,
Sakthivel P.
public class ComboBoxDataBase
{
static object locker = new object();
ISQLiteService SQLite
{
get
{
return DependencyService.Get<ISQLiteService>();
}
}
readonly SQLiteConnection connection;
readonly string DatabaseName;
public ComboBoxDataBase(string databaseName)
{
DatabaseName = databaseName;
connection = SQLite.GetConnection(DatabaseName);
}
public void CreateTable<T>()
{
lock (locker)
{
connection.CreateTable<T>();
}
}
public int SaveItem<T>(T item)
{
lock (locker)
{
var id = ((Employee)(object)item).ID;
return connection.Insert(item);
}
}
public IEnumerable<T> GetItems<T>() where T : new()
{
lock (locker)
{
return (from i in connection.Table<T>() select i).ToList();
}
}
public int DeleteAll<T>()
{
lock (locker)
{
return connection.DeleteAll<T>();
}
}
} |
<combobox:SfComboBox
x:Name="comboBox"
DataSource="{Binding EmployeeCollection}"
DisplayMemberPath="ZeeBoot" /> |
public partial class MainPage : ContentPage
{
ViewModel comboBoxData = new ViewModel();
public ObservableCollection<Employee> EmployeeCollection { get; set; }
public MainPage()
{
InitializeComponent();
EmployeeCollection = new ObservableCollection<Employee>();
var employee = comboBoxData.ItemsSource.GetItems<Employee>();
foreach (Employee emp in employee)
{
EmployeeCollection.Add(emp);
}
comboBox.BindingContext = this;
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.