Is it possible to set the x:Reference
Markup extension for a binding in code?
For example:
{Binding SelectedItem, Source={x:Reference ComboList}}
So i create a binding like this:
Binding b = new Binding("SelectedItem");
b.Source = //What to put here??
I was previously using ElementName
but I had some issues with the NameScope as referred in this question because this binding is set in a ComboBox which is inside of a UserControl I created, and apparently if I use ElementName
the namescope is limited only to that UserControl and not outside..
Thanks!