0
votes

I have a button column on my datagrid view. Please advise how to show an image on that button? Please advise for both design time and run time. Thanks

1

1 Answers

0
votes

If its the same image on every button then this will likely do:

<DataGridTemplateColumn>
  <DataGridTemplateColumn.CellTemplate> 
    <DataTemplate> 
   <Button>
    <StackPanel>
        <Image Source="Images/YOUR_IMAGE.jpg" />
        <TextBlock>YOUR TEXT</TextBlock>
    </StackPanel>
   </Button>
 </DataTemplate> 
  </DataGridTemplateColumn.CellTemplate> 
</DataGridTemplateColumn>

And if you want to bind the image from your datasource you will need to implement an IValueConverter - see this thread for more details.