I have the following DataTemplate for a listbox:
<DataTemplate x:Key="MoviesTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding S_Poster}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,10,8,0"/>
<StackPanel Orientation="Vertical" Width="200">
<TextBlock Text="{Binding Name}" FontSize="20"/>
<TextBlock Text="{Binding Type}" FontSize="16"/>
<TextBlock Text="{Binding Theaters_S}" FontSize="16"/>
</StackPanel>
<StackPanel ItemsSource="To be bound to the custom stack"/>
</StackPanel>
</DataTemplate>
I need to bind the stack "StackPanel ItemsSource="To be bound to the custom stack" to a stackpanel i define in C# code named "Stack_PIC" referring to a stack of pics which is coded as follows:
for (int i=0; i < full; i++)
{
Image star = new Image();
star.Source = new BitmapImage(new Uri("/Images/Small_F.png", UriKind.Relative));
d.Rating_PIC.Children.Add(star);
}
My purpose behind this is to add rating stars to the ListBoxItems, So what is the correct way to bind the content of this stack to the following custom content??
UPDATE:
I kow that the stackpanel can't be bind this way and the alternative is to use a structure called ItemsControl as shown in this Question. However, i didn't understand the complete answer there and how to map it to my case so any help to clarify this is appreciated.