In this post we’re going to see how to dynamically get the value of a property by using only its name. This started from me trying to understand how data binding works in XAML and implementing it myself. For this, I needed a view model which implements the INotifyPropertyChanged and then subscribe to its PropertyChanged event.
The view model
The main program
Just for fun I used R. Daneel Olivaw as an example…
Explanation
To get the property value we first need to know on what Type it resides, then the property name and finally the target object.
This is a simple concept and in case I ever need it I know where to look for a quick refresher.