Bonjour à tous;
voilà comment je peux lier mon TextBlock qui ce trouve dans une listbox à une collection d'objet.
mon code XAML
Merci d'avance
Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <Window x:Class="ImageList.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="522" Width="563" Loaded="Window_Loaded"> <Grid Height="476"> <Grid.ColumnDefinitions> <ColumnDefinition Width="476*" /> <ColumnDefinition Width="65*" /> </Grid.ColumnDefinitions> <ListBox Margin="9,11,0,14" Name="listBox1" ItemsSource="D:\MyWorks\ImageList\ImageList\Resources\Dossier.jpg" HorizontalAlignment="Left" Width="362" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="D:\MyWorks\ImageList\ImageList\Resources\Dossier.jpg"></Image> <TextBlock Name="Libelle" ????}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> </Window>
Partager