Hello.
There is a template in the listbox to display several fields of the table and there is a button to delete. I can associate it with a field from a table and at the same time find out the value of which button was pressed.
<telerik:RadListBox > <telerik:RadListBox.ItemTemplate > <DataTemplate> <Grid > <TextBlock Text="{Binding Path=Fio, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> <Label Content="{Binding Path=value2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> <Button Content="Х" Margin="5" HorizontalAlignment="Right" Tag="{Binding Path=Fio}" Click="ButtonDelete_Click" Name="ButtonDelete"/> </Grid> </DataTemplate> </telerik:RadListBox.ItemTemplate> </telerik:RadListBox>
here is the button click handler:
private void ButtonDelete_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; string Fio = (string)btn.Tag; MessageBox.Show(Fio); }
at the same time I see, in front of which name the button was pressed.
And how do you know which account was pressed on the button, i.e. from which ListBoxItem
this listbox.