Hello,
I've in my C# class:
- foreach (var item in horaires)
- {
- var Objet = item.Horraire.ToString();
- listBox.Items.Add(Objet);
- }
And in my XAML:
<ListBox x:Name="listBox" Grid.Row="1"/>
My data are great, but I would custom my ListBox with:
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Border BorderBrush="White" Margin="0" BorderThickness="0,0,0,0.5">
- <StackPanel Orientation="Horizontal" Margin="0,5,0,5" VerticalAlignment="Top">
- <TextBlock Text="{Binding item}"
Name="item"
FontSize="36"
VerticalAlignment="Top"
TextAlignment="Left"
TextWrapping="Wrap"
Width="340"/>
</StackPanel>
</Border>
</DataTemplate>
- </ListBox.ItemTemplate>
But With, my data don't show. So, How to display my data with this model?
I would like make listBox.Items.Add(Objet); in my TextBlock Name="item"
Thanks for your helps.
Valentin