Introduction
Now, I will explain how to do data binding in a simple way in just a few steps. In this example, we will bind some elements so changing the value of one effects the value of other dynamically.
- Create a new project and add a
slider
, textblock
and progressbar
.
![Adding Controls Adding Controls](/KB/database/1061147/Animation_DataBindingSimple.gif)
- Now first bind the
progressbar
with the slider
, for this we have to bind the value
attribute of progressbar
with the value attribute of the slider.
![Binding Progressbar Binding Progressbar](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
- Now also bind the
textblock
’s text attribute with the slider’s value
attribute. After the successful binding, the small indicator will turn into yellow.
![Image 3](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
and textblock
value will be 0
.
![Binding Textblock Binding Textblock](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
- Now run the project and see the binding in action .
![Binding In Action Binding In Action](data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)
Source code: https://github.com/umerqureshi93/SimpleDataBinding
Personal blog: http://csdebugger.blogspot.com/
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.