Documentation
XnaBind provides a simple way to perform property data binding in Xna Games.
With XnaBind you can create a dynamic link between two object properties and let the update themselves automatically.
The code was written in C# and focused on Xna game development, but it can be used in all .Net project and also with another programming languages.
To learn more how to use XnaBind please see
Tutorials and
Samples pages.
RequirementsXnaBind requires .Net Framework 3.5 or higher because it uses
Lambda Expressions to offer more power when link two properties.
Xna Game Studio 3/3.5 on Visual Studio 2008 or Visual C# Express 2008.
Classes
To understand better how XnaBind works see the description of its class architecture.
The project is very objective and it is composed by three classes: Bind, BindDirection and BindableProperty
Bind Class
A dynamic bind between two properties
Simple Bind Class
Compound Bind Class

Examples
//Simple Bind
this.bind1 = new Bind<float>(sprite1X, sprite2.X, BindDirection.OneWay);
//Simple Bind with Lambda Expressions
this.bind2 = new Bind<float>(sprite1X, sprite2.X, x => x + 5);
//Compound Bind
this.bind3 = new Bind<float, string>(sprite1X, label1.Text, BindDirection.OneWay);
//Compound Bind with Lambda Expressions
this.bind4 = new Bind<float, string>(sprite1X, label1.Text, x => "x=" + x + "px");
BindDirection Enumeration
Represents the directions the properties will be bind.
public enum BindDirection
Examples
//OneWay
this.bind1 = new Bind<float>(sprite1.Y, sprite1.Y, BindDirection.OneWay);
//TwoWay
this.bind2 = new Bind<float>(sprite1.Y, sprite1.Y, BindDirection.TwoWay);
BindableProperty Class
A property container that fires a Changed Event when the property value is set
public class BindableProperty<T> : IConvertible
Examples
//BindableProperty float
public BindableProperty<float> X { get; set; }
//BindableProperty string
public BindableProperty<string> Text { get; set; }
Complete Class Diagram
Here is the class diagram for XnaBind project show all interface implementations and relationship between classes.
The Class Diagram inclued in the source can be visualized only by Visual Studio 2008.
