0

So I have a custom WPF UserControl called Row. It has a DependencyProperty called Index. The DataContext of Row is a class called ViewModel which contains an ObservableCollection. Within the XAML of Row, if possible, I want to bind the text in a TextBox with whatever element is at Index inside said collection. So, something like this:

<TextBox Text="{Binding Elements[{Binding Index}]}" />

How can I access Index, which is in Row's codebehind, in Row's xaml if the DataContext of Row is something else?

I hope that I explained this clearly, thanks in advance for whatever help is provided.

  • see if these helps you https://msdn.microsoft.com/en-us/library/system.windows.data.binding.path(v=vs.110).aspx , https://msdn.microsoft.com/en-us/library/ms742451(v=vs.85).aspx – AnjumSKhan Feb 17 '18 at 04:29
  • Possible duplicate of [Passing two command parameters using a WPF binding](https://stackoverflow.com/questions/1350598/passing-two-command-parameters-using-a-wpf-binding) – Rekshino Feb 19 '18 at 13:49

0 Answers0