title: Binding, Context, ContextBinding and BindingContext in ui5
body: <p>I have been pondering the internals of and relationship between context, contextbinding, and bindingcontext for a few days now and i am not sure whether there is a major misconception on my side. Maybe some of you can help me sort it out. I am putting my assumptions below. I might want to say first that I always work with oData models here.</p>
  
  <p>This is what I believe to understand reading the documentation:</p>
  
  <p>A <strong>context</strong> is a reference to a data object in a model.</p>
  
  <p>A <strong>binding</strong> is basically an event provider which (in case of a one way binding) observes the status of a specific context and emits events when it is changed/data loaded ... and therefore allows for registering event handlers for events on that specific context. In terms of programming objects, there are property bindings and list bindings (is this true - or is list binding all that is ever relevant?). </p>
  
  <p>At any rate, my understanding is that a list binding is the model-side of a component's aggregation binding, while a property binding is called property binding both from a component's and a model's point of view (confusing?).</p>
  
  <p>Now what I do not quite get is:
  The context binding <code>new sap.ui.model.ContextBinding(oModel, sPath, oContext, mParameters?, oEvents?):</code> takes a path and a <strong>context</strong> as a parameter. I am assuming that this oContext is not exactly the context described above but some metadata on the binding. is this correct? Or is this the definition of thep ath which the path parameter is relative to? </p>
  
  <p>What also seems weird is when you want to create a context itself <code>new sap.ui.model.Contextabov(oModel, sPath, oContext)</code> takes a context again.
  I believe that this is just an unfortunate naming thing i am looking at, but I am not quite sure.</p>
  
  <p>Then there is contextbinding and bindingcontext. I'd assume that contextBinding is the binding to a specific context as described e. And a bindingcontext is the meta data regarding a context- or list binding.</p>
  
  <p>From a programming point of view, I do not understand why the following works:</p>
  
  <ul>
  <li>create list binding to context via <code>model.bindList()</code> passing a path only.</li>
  <li>attach change-event handler to binding</li>
  <li>call <code>get_contexts()</code> on binding</li>
  <li>receive data in change event handler (and see the oData-property filled in the model).</li>
  </ul>
  
  <p>and there seems to be no way of doing the same for a property binding which i'd assume I can generate via <code>model.bindProperty()</code>. I can generate the binding, but the binding I receive seems to have no handle to actually fetch data.</p>
  
  <p>I hope the ramble explains my problem. In case you ask : what do you want to do? I actually do not want to do anything with it, I just do not quite understand how this works. Binding to ui controls and so forth works just fine, but I'd prefer to really understand what is underneath the hood. I have been reading debug files and unit tests a bit, but discussing it with you guys seems a great way as well.</p>
  
  <p>If this is unclear I'll happily add anything that helps.</p>
  
  <p>Cheers
  Michel</p>