Hi! I'm trying to figure out how to go about binding my ObservableCollection to a DataTemplate XAML. On the 'Entry' i want to be able to update the values from other places, but to do that it needs to know at what index its value is located in the Collection. With the help of the ClassId i would be able to extract the index at which the Entrys value is located, but im not sure how to do that in XAML or in code behind since it is a DataTemplate. Help?
In short, I want to extract the index from ClassId in codebehind, and then use the value i got to bind the Text element to RegAdrListUInt16.Index
<DataTemplate x:Key="Int16Template">
<ViewCell>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="1.5*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding TranslatedName}" VerticalTextAlignment="Center" Margin="10,0,0,0">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding SettingsViewModel.ShowInfoCommand, Source={x:Static viewModels:ViewModelLocator.Current}}"
CommandParameter="{Binding}"></TapGestureRecognizer>
</Label.GestureRecognizers>
</Label>
<Entry Grid.Column="1" Keyboard="Numeric" Text="{Binding Path=RegAdrListUInt16.-Name here-}"
ClassId="{Binding Name}"
TextChanged="Entry_OnInt16TextChanged" Margin="0,0,10,0"/>
</Grid>
</ViewCell>
</DataTemplate>