How do I resolve the value of a databinding inside a MarkupExtension?
I've made a markup extension for translating strings based on a key. Example <TextBlock Text="{Translate myKey}" /> Now I want to be able to use nested bindings for providing my keys. Example: <TextBlock Text="{Translate {Binding KeyFromDataContext}}" /> When I do this I get a System.Windows.Data.Binding object. By calling ProvideValue and passing down the ServiceProvider I can get a BindingExpression: var binding = Key as Binding; if (binding == null) { return null; } var bindingExpression = binding.ProvideValue(_serviceProvider) as BindingExpression; if (bindingExpression == null) { return