I want to programmatically find out what the default binding mode of a property will be.
For example, if I check it against TextBox.TextProperty it should be BindingMode.TwoWay, but if it is ItemsControl.ItemsSourceProperty it should be BindingMode.OneWay.
I implemented a custom MarkupExtension and have gotten this far in my code so far:
public override object ProvideValue(IServiceProvider provider)
{
var service = provider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
if (service != null)
{
var target = service.TargetObject as DependencyObject;
var property = service.TargetProperty as DependencyProperty;
// Not sure what to do with the target and propery here...
}
}