I have a listview populated with data from database and a iwould like to add a button in the last column for each row displayed in the listview here is my XAML :
- <ListView x:Name="listView" ItemsSource="{Binding}" HorizontalAlignment="Left" Height="520" Margin="27,57,0,0" VerticalAlignment="Top" Width="1133">
- <ListView.View>
- <GridView x:Name="gridView">
- <GridViewColumn>
- <GridViewColumn.CellTemplate>
- <DataTemplate>
- <CheckBox Tag="{Binding fournisseur}" IsChecked="True"/>
- </DataTemplate>
- </GridViewColumn.CellTemplate>
- </GridViewColumn>
- <GridViewColumn DisplayMemberBinding="{Binding fournisseur}" Width="280">
- <GridViewColumn.Header>
- <GridViewColumnHeader Tag="Fournisseur">Fournisseur</GridViewColumnHeader>
- </GridViewColumn.Header>
- </GridViewColumn>
- <GridViewColumn DisplayMemberBinding="{Binding email}" Width="280">
- <GridViewColumn.Header>
- <GridViewColumnHeader Tag="Email">Email</GridViewColumnHeader>
- </GridViewColumn.Header>
- </GridViewColumn>
- <GridViewColumn Header ="Date" DisplayMemberBinding="{Binding date}" Width="150"/>
- <GridViewColumn Header="Fichier CSV" DisplayMemberBinding="{Binding files}" Width="370">
- <GridViewColumn.CellTemplate>
- <DataTemplate>
- <Button Tag="{Binding}" Content="Open File" Click="OpenFile_OnClick"/>
- </DataTemplate>
- </GridViewColumn.CellTemplate>
- </GridViewColumn>
- </GridView>
- </ListView.View>
- </ListView>
and here is my c# code where i fill my listview :
- TOPSAGEEntities db = new TOPSAGEEntities();
- var query = from fournisseur in db.F_COMPTET
- join email in db.F_ECHEANCES on fournisseur.CT_Num equals email.CT_Num
- where EntityFunctions.TruncateTime(email.cbModification) == EntityFunctions.TruncateTime(DatePicker.SelectedDate)
- select new { fournisseur = (string)email.ECH_Intitule, email = (string)fournisseur.CT_EMail, date = (DateTime)email.cbModification};
-
-
- listView.DataContext = query.ToList().Distinct();
what's wrong with my code ?