All tagged sqlite

How the heck does one do DataBinding with XAML

DataBinding is one of those things that once you learn, you have no idea how you lived without it before.

Being one of the most important things you can learn about XAML, this lecture builds on the example that we have been building in previous lecture to complete an introduction to the Xamarin platform. After this, you will be much more efficient when creating and linking your interfaces to your apps’s logic.

Using ListViews in Xamarin Forms

So now you have read the data from the SQLite table into a list of C# objects that are ready to be listed into the user interface.

Now it is time to learn how to use ListViews, which will be the go-to element when you need to display a collection of data to your users.

Reading a SQLite Database

Reading a database will be very straight forward, especially once you know how to establish the connection to the database, which you should already know thanks to our previous post.

All you have to make sure of now is that when reading, you get all that data in the correct format, not as a simple query to a database, but as an actual list of elements. So in this lecture I cover how to do exactly that.

Inserting to a SQLite Database

Well, now that the Model is ready, and the database is created for both Android and iOS scenarios, there is nothing left for us to do but to start adding the functionality for the necessary requests inside of our application.

In this video, I start by explaining how to insert to the database, and how a specific usage of the using keyword will be rather important for you to understand.

SQLite Xamarin Forms Tutorial - iOS Database Path

When using SQLite inside of your applications, you will need to set the location for the database file.

In this video I cover what you have to do for the iOS scenario, which indeed will be slightly different from the Android one, which means that we will have two versions of the same code -one per platform- and that we will need to code some functionality in the platform-specific projects.

SQLite Xamarin Forms Tutorial - Android Database Path

When using SQLite inside of your applications, you will need to set the location for the database file.

In this video I cover what you have to do for the Android scenario, which indeed will be slightly different from the iOS one, which means that we will have two versions of the same code -one per platform- and that we will need to code some functionality in the platform-specific projects.

Local Databases in Xamarin Forms with SQLite

I don't need to argue that databases are of great importance in almost any kind of application, so in this post, I will cover the usage of local SQLite databases inside a Xamarin Forms app.

Specifically, we will be creating a simple notes app, with a couple of views: one where the user will see the list of notes and another one for creating/editing a note. While I will briefly explain the code that I use to define the interface, I will focus on the SQLite functionality itself, not really talking about the event handlers and the definition of elements inside the XAML file. If you are not familiar with XAML maybe check one of my previous posts first.

I do want to specify that I created this project using a .NET Standard library as a code sharing strategy and that I will cover Android, iOS and UWP implementation. If you are using Visual Studio for Mac, UWP won't be an option, and maybe your code sharing strategy will be PCL instead of .NET Standard, but the implementation is identical, except for the folder where you need to reference the SQLite packages.