I set the items source of my WPF Datagrid to a list of objects returned from my DAL. I also added an extra column that contains the button, xaml is below.
<toolkit:DataGridTemplateColumn MinWidth="100" Header="View"> <toolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Click="Button_Click">View Details</Button> </DataTemplate> </toolkit:DataGridTemplateColumn.CellTemplate> </toolkit:DataGridTemplateColumn>
It is perfectly. However, in the Button_Click method, is there a way to get the row on the datagrid where the button is? In particular, one of the properties of my objects is "Id", and I would like to pass this to the constructor of another form in the event handler.
private void Button_Click(object sender, RoutedEventArgs e) {
Perhaps I need something extra in my xaml, or maybe I will get around this? Any help / advice appreciated.
c # wpf xaml datagrid datagridview
RekrowYnapmoc Jul 23 '09 at 0:26 2009-07-23 00:26
source share