I have a datagrid that I bind to a database table. Here is the XAML
<dg:DataGrid Name="dgContents" Grid.Column="1" AutoGenerateColumns="False" RowEditEnding="dgContents_RowEditEnding">
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding name}" Header="Name"></dg:DataGridTextColumn>
<dg:DataGridTextColumn Binding="{Binding ip}" Header="ip"></dg:DataGridTextColumn>
<dg:DataGridTemplateColumn Header="Progams">
</dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
Here is the code I use to databind it. It's run on click from a treeview
public void changeFolder(int folderId)
{
selectedFolder = folderId;
var f = from c in rbdb.contents where c.folderId == folderId select c;
dgContents.ItemsSource = f;
}
What I want is to create a number of buttons inside the datagridtemplate. I want one "add" button, then I want a dynamic number of buttons based on a SQL table thats called "commands". A click on the buttons should call a program, a right click should bring up a menu where the user can edit or delete the button. How do I do this?