i have a combo box present inside a list-box , listbox has a datatemplate in which this combobox and other elements resides .
<ListBox x:Name="lstbxbProducts" HorizontalAlignment="Left" Height="547" Margin="0,221,0,0" VerticalAlignment="Top" Width="1044" RenderTransformOrigin="0.600000023841858,0.5">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<StackPanel Width="80" Orientation="Horizontal">
<TextBlock Text="{Binding prdnum}" VerticalAlignment="Center" HorizontalAlignment="Left" ></TextBlock>
<TextBlock Text=" -" VerticalAlignment="Center" HorizontalAlignment="Left" ></TextBlock>
</StackPanel>
<StackPanel Width="400">
<TextBlock Text="{Binding prddsc}" VerticalAlignment="Center" HorizontalAlignment="Left" ></TextBlock>
</StackPanel>
<StackPanel Width="300">
<ComboBox Name="cmbbxbUMselec" ItemsSource="{Binding}" Width="200" FontSize="24" VerticalAlignment="Center" HorizontalAlignment="Center" ></ComboBox>
</StackPanel>
<StackPanel Width="180">
<TextBlock Text="{Binding prcby_prc}" VerticalAlignment="Center" HorizontalAlignment="Center" ></TextBlock>
</StackPanel>
<StackPanel Width="100">
<TextBox Text="{Binding stdordqty, Mode=TwoWay}" VerticalAlignment="Center" TextAlignment="Center" HorizontalAlignment="Right" ></TextBox>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
My doubt is that i am not able access the combobox present inside a the datatemplate of the listbox , i want to bind a list to the combobox from c# codebehind
cmbbxbUMselec.DataContext = lstumcods;
in this way from code behind but i am not able access the combobox present inside a the datatemplate of the listbox
Please let me know how can i work around this.
Thanks in advance