How do you programatically set a DataContext that specifies the selected item of a list?
More simply, how do you reproduce this type of binding in code?
<StackPanel>
<ListBox Name="listBox1" />
<TextBox Name="textBox1" DataContext="{Binding ElementName=listBox1, Path=SelectedItem}" />
</StackPanel>