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.
FrameworkElementFactory(typeof(Button))
, how do I add the Button Text? I have been unable to do so, or am I missing something? – Voiture