我有一个DataGridWPF.而且我试图将Buttons 添加到网格的某些单元格中,然后绑定到特定的单元格ItemsSource.我试图在xaml中这样做:
<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>
Run Code Online (Sandbox Code Playgroud)
但是,我想知道如何在后面的代码中执行此操作.我需要这个,以便Button每当特定点击发生时我都可以放置.任何帮助将受到高度赞赏.