I have a DataGrid
in WPF. And I am trying to add Button
s to certain cells of the grid, after it is bound to a particular ItemsSource
. I have tried to do this in the xaml like this:
<dg:DataGridTemplateColumn x:Name="R1" CanUserReorder="False" IsReadOnly="False">
<dg:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<awc:ImageButton Content="Edit" Name="btnEdit" Visibility="Collapsed"/>
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
</dg:DataGridTemplateColumn>
However, I want to know as to how I can do this in the code behind. I need this so that I can place Button
s whenever a particular click even takes place. Any help will be highly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…