https://github.com/dsuarezv/binder
A small databinding library. Use it to bind stuff to your game UI if your engine doesn't have it already.
https://github.com/dsuarezv/binder
Last synced: 5 days ago
JSON representation
A small databinding library. Use it to bind stuff to your game UI if your engine doesn't have it already.
- Host: GitHub
- URL: https://github.com/dsuarezv/binder
- Owner: dsuarezv
- Created: 2016-04-27T06:45:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-27T07:10:50.000Z (about 10 years ago)
- Last Synced: 2025-02-25T02:23:46.779Z (over 1 year ago)
- Language: C#
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
A simple data binding library for .Net.
# Usage
```c#
var slider = new Slider() { MinValue = 0,MaxValue = 10};
var model = new MyModel() { Data = 5 };
// Bind the model to the control
var b = new Binding(model, "Data", slider, "Value", BindingMode.TwoWay);
```
In this sample, two-way binding is used, meaning that a change in the model will update the slider control, and viceversa. It is also posible to setup bindings in a single direction (Source to Target or Target to Source).
For the binding to work, the source object has to implement the [INotifiyPropertyChanged](https://www.google.com/search?q=INotifiyPropertyChanged) interface.
# License
This code is licensed under the MIT license.