WPF Datacontext binding
If any other source is not specified for data bindings then WPF by default searches the data Context.There’s are no default sources for the data Context property, you need to assign it some value otherwise binding will be null.So, whenever you are using binding you are binding with the data context of the corresponding element.
In WPF every framework element and every FrameworkContentElement has a DataContext property. DataContext is an object used as a data source during the binding, address by WPF binding Path.
If you don’t specify a source property WPF search up the element tree starting at the current element.
In data context binding, you make object of your property and you get data by using that object. You can also use this object multiple times and you can access different data every-time you use it.
We use this to perform element property binding and when the project is being load, at that time by default it will be null, but as we run the project and as we use it, the data will be loaded. For this purpose, binding is performed and If we do not use the object than it will be null.
In data context binding, after binding the element we can set the value of the object at runtime which is also useful for designing. If we want to set property like height-width or background color of control to another control than we can easily do it by using data binding and by doing this it will save time as well as will have less lines of code.