I have a binding to an unknown source. All I have is the binding. I have no other way of looking at the bound object. I need to figure out the Type for the bound object, even if the value is null (this is where my problem is).
I was evaluating the binding by binding to an object and then using the object as a way to get the Type, but I need to know the type even if the value is null.
For instance, I have a class like so:
public class Customer{
public string Name { get; set; }
public int Age { get; set; }
}
Now, if I have a WPF control bind to any of those properties (let's assume they are dependency properties) I would like to get the type of the property, even if the value is null.
So, I have a custom control that now has a Binding object that represents {Binding Name} for instance. How can I get the type of the "bound object" using C#?