How to use ViewModel when retrieving data from a SQLite database.

2 posts, 0 answers
  1. Rajesh
    Rajesh avatar
    22 posts
    Member since:
    Jun 2009

    Posted 03 Jan Link to this post


    I am interested in using your AutoComplete Control where data is bound to a ViewModel and it is retrieved from a SQLite database following this link

    Can you please let me know if this is possible with an example.

    1. The data for the view model is retrieved from a Sqlite database in Xamarin Forms (ios or Android)

    2. The data is pulled in an async method from the database and the volume of data will vary.

    3. I need to have 2 columns for every autocomplete control viz. ID and Name. (ID is the unique id for the data and is saved in the database when selected and Name is the friendly name displayed in the autocomplete control.

    4. How should this be executed when i have at least 7 autocomplete controls in a single Content page. Should all be executed in the onAppearing Event.








  2. Yana
    Yana avatar
    4651 posts

    Posted 09 Jan Link to this post

    Hello Rajesh,

    Thank you for your interest in RadAutoComplete for Xamarin.

    I will go straight to your questions:

    1 and 2: RadAutocomplete could be bound to a list of business objects via a ViewModel, the actual data could be retrieved in various ways including SQLite database. I have created a sample project to demonstrate how you could populate the control after getting the items asynchronously - the example is based on the following tutorial and sample app: Xamarin.Forms Local Databases.

    3. In the attached example I've used a class named CategoryItem with a unique ID marked with PrimaryKey and AutoIncrement attributes like this:

    public class CategoryItem
        [PrimaryKey, AutoIncrement]
        public int CategoryID { get; set; }
        public string Category { get; set; }

    4. This seems as a straightforward solution, however it's more of application logic and as I am not aware of the exact setup and the requirements you have, I'd prefer not giving recommendations on this.

    Let me know if I can assist with anything else.

    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top