0
votes

I have a wpf app, where a datagrid has autogeneratedcolumns, and I want after that columns add two more containing buttons, I've tried working with datagridtemplatecolumn and code, but nothing. Any help? Thanks...

<DataGridTemplateColumn>
   <DataGridTemplateColumn.CellTemplate>
     <DataTemplate>                                            
       <Button x:Name="btnEdit" Tag="{Binding Category}">Edit</Button>
     </DataTemplate>
   </DataGridTemplateColumn.CellTemplate>
 </DataGridTemplateColumn>
1
Do you want the buttons added to each and every row? Can you give an example of what you tried that isn't working?Jeff R.
yes, buttons added to each and every row, I edit the question and there's the code, I'm using resource dictionary for the style.Yara Undomiel

1 Answers

0
votes

I fixed the problem, thanks! Here is the solution, just in case... :)

<DataGrid.Columns>
 <DataGridTextColumn Visibility="Hidden"/>
 <DataGridTextColumn Header="Category" Binding="{Binding Category}" />
 <DataGridTemplateColumn Header="Birthday">
   <DataGridTemplateColumn.CellTemplate>
     <DataTemplate>
       <Button Content="Edit" />
     </DataTemplate>
   </DataGridTemplateColumn.CellTemplate>
 </DataGridTemplateColumn>