01 – BindingContext


The BindingContext property is used for all data binding. This tutorial introduces the BindingContext property and creates a simple example using BindingContext to control the UI.

Example Screen

For this tutorial we will create a Gum screen which contains the following:

  • Points Display
  • Health Bar
  • Button for awarding points
  • Button for taking damage
  • Button for healing

Normally the actions performed by the buttons listed above would occur through regular game logic (such as collision) but we will use buttons for the sake of simplicity.

The specifics of the visuals do not matter, so your screen may look like the following:

A few details in the screen above are important:

  • The three buttons are FlatRedBall.Forms Button objects
  • The HealthBar is contained within a HealthContainer using the Percent Width Units
  • Each object in the screen is descriptively named. This will make data binding easier.