52 Weeks of Xamarin: Week 13 – Writing It Thrice

In this and a number of following posts, I’ll build the same program three times: once in Xamarin.Forms, once in iOS and once in Android.  ToDoListForms

This is directly based on my Pluralsight course, Beginning Mobile Development with Xamarin

To get started, we’ll go through the Xamarin.Forms application fairly quickly as this series has already covered a lot of material on writing Xamarin.Forms applications.   Let’s begin by creating our model class: ToDoItem

Continue reading

Posted in Essentials, Xamarin | 1 Comment

52 Weeks of Xamarin: Week 12 – Advanced Customized Controls

Last week we looked at a simple example of customizing a control and creating a SpecialBoxViewcustom renderer.  This week we go a bit deeper.  Our goal is to give a BoxView a border, and to adjust that border dynamically.

[ This content is taken from my forthcoming Pluralsight course ]

As noted last week, we start with an Element and a Renderer.  In our case, the element will be a SpecialBoxView.  Unlike last week, however, this custom class will have contents; specifically the properties we want to be able to bind to.

Continue reading

Posted in Xamarin | 1 Comment

52 Weeks of Xamarin: Week 11 – Customized Controls for Xamarin.Forms

Xamarin.Forms is a killer framework, and it has a wide variety of very flexible controls.  But sometimes you run into restrictions on the control that you really need to override.  The answer to this dilemma is to create a customized control.

ShadedButton

To understand how to create a customized control, you must first understand that every control consists of an element (e.g., a button) and a renderer (the platform-specific code that tells the phone how to draw the element.

The trick to customizing a control is to override one or more methods in the renderer.  To see this at work, we’re going to start very easy with a shaded button.  Future postings will tackle more complex rendering.

[This blog post is based on material from my forthcoming Pluralsight course]

Continue reading

Posted in Xamarin | 1 Comment

52 Weeks of Xamarin: Week 10 – The UI for our database program

Last week we created the code to add and find a “person” in our SQLite database.  This PersonDBUIweek we’ll finish up by creating the View and the ViewModel.

The View is where most of the action is, in this small demo project.  We’ll have two views: one to capture the information and one to display it (see figure).

Create a page named EnterPerson.xaml to capture the user name.  The user interface is very simple: there is a label to indicate that we are capturing a new person’s name, two entry boxes: one for the first and one for the last name, and three buttons: one for save, one for cancel and one for review that takes you to the second page.

Continue reading

Posted in Xamarin | 1 Comment

52 Weeks of Xamarin: Week 9 – Databases part 1

Working with SQLite as your database in Xamarin.Forms is not difficult but it does involve some specific steps: Database computers small

  • Add the SQLite-.Net PCL library to all three projects
  • Create the ISQLite interface
  • Add a singleton to your app class
  • Open your database in the appropriate directory and use DependencyService to access it
  • Create your table(s)
  • Write your CRUD operations

Piece of cake.

In this and the next posting I’ll go over these steps in detail and in context.

Continue reading

Posted in Xamarin | 2 Comments

52 Weeks of Xamarin: Week 8 – Testing the View Model

Until now, our tests have focused on the model, Projects.  The point of MVVM, however, is to enable sufficient separation of concerns to allow testing of the program’s logic in the ViewModel.

Today, we turn to ViewModel tests, using these tests both to drive the development of the ViewModel, and also to ensure the integrity and correctness of the logic as we refactor the code.

Continue reading

Posted in Testing, Xamarin | 1 Comment

52 Weeks of Xamarin: Week 7 – First Unit Tests

In the previous posting, I set up the ProjectTracker solution, including the xUnit testing folders.   We talk a lot about test-driven design, but the truth is that we (most of us?) start with an overall architecture in mind prior to writing anything.

For ProjectTracker, I know I’m going to have a project model, and I know that it will contain a name and a way to get the total duration of work on the project, as well as “segments” which will hold each “chunk” of work.

I also know that I’ll have multiple projects but that at most one will be active at a time.

Now, the specifics of how to put that into code… well that I’m going to determine test-first:

Continue reading

Posted in Xamarin | 1 Comment

52 Weeks of Xamarin: Week 6 – Starting xUnit Testing

Last week we decided to start with test-first development using XUnit.  To
get underway, let’s create a eggwithlight new Xamarin.Forms application called BlogProjectTracker.

Once the projects are created we’ll return to the solution and add a new .NET project of type Portable Library which we’ll call BlogProjectTracker.Tests.

Finally, we’ll add an empty iOS project which will be used as the test runner, and which we’ll call BlogProjectTracker.Tests.iOS.  We can then do the same for Android calling the new project BlogProjectTracker.Tests.Droid

Continue reading

Posted in Essentials, Xamarin | 2 Comments

Newest Pluralsight Course: Beginning Mobile Development with Xamarin

Incredibly excited to announce my latest Pluralsight Course:  Beginning Mobile Development with Xamarin.

In this course, you will build a real-world application three times, using three different Xamarin platforms, giving you tremendous insight into how Xamarin programs are created and how they relate to the underlying technologies. This course covers creating the user interface, the data model, and the logic of the program. Data and Event Handling are key parts of this course, as is persistence to a SQLite database.

coll looking dancer posing on a grunge grey wall

Posted in Xamarin | 1 Comment

What Languages Have You Learned?

I started programming in 1971, but didn’t much like it and didn’t start professional programming until 1985.  I’d be very interested in when you started, and what languages you used since then (languages you used to write something meaningful)  Here is most of my list (the ones in bold I used to write commercial applications)

Continue reading

Posted in Essentials | 2 Comments

52 Weeks of Xamarin: Week 5 – Diving in the deep end

AngerFor the past four weeks, we’ve been reviewing the fundamentals of Xamarin.  Let’s stop for a bit and talk about how we really code, and how we should.

In my Pluralsight courses, I take you through each skill, step by step, but here I’d like to try giving you a lot of information at once, and see what comments you leave about the pace and quantity of information.

So let’s start a new project, not unlike the previous, but this time we’re going to build it out using unit tests and all the goodies of a real application.  Again, fasten your seatbelts because we’re going to cover a lot of ground quickly.

Continue reading

Posted in Essentials | 3 Comments

52 Weeks of Xamarin: Week 4 – Creating the Model and Saving

CheckListThis week we’ll save the Tasks in memory, in coming weeks we’ll review databinding and we’ll review the tasks in a bound list.

NB: We’re moving very quickly through the preliminaries, so please do use the comments to ask questions or let me know where there are areas of confusion.

The Model

The first job is to create a task model: a class whose instances can each represent one task.

Continue reading

Posted in Xamarin | 1 Comment