开发者

Show image in WPF DataGridColumn

I am Binding my wpf DataGrid to an ObservableCollection from code. I am adding the columns by code (as they may change on every report) The UI Deisgner n开发者_如何学JAVAow wants a Column wiht Images for "Delete this row" and "do a special action" on this row. So two Images in one column, and when clicked different behaviour.

Any ideas how to get this done? Thanks in advance!


use this

<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
  <DataTemplate>
    <StackPanel Orientation="Horizontal">
      <Button Click="1st--Handler----here">
        <Image Source="image--path--here"/>
      </Button>
      <Button Click="2nd--Handler----here">
        <Image Source="image--path--here"/>
      </Button>
    <StackPanel>
  </DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>


You can use a DataGridTemplateColumn to specify your own DataTemplate and render the cell the way you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜