Search code examples
wpfdatagridcell

how to add multiple images in a cell of WPF Datagrid?


I need to add three Images in WPF Datagrid Cell. Normally i can just add 1 Image per cell.

but i dont know how to do it using DataTemplate.

<dxg:GridColumn.CellTemplate>
                                        <DataTemplate>

                                        </DataTemplate>
</dxg:GridColumn.CellTemplate>          

Thank you.


Solution

  • You can just put it all within a StackPanel

    <dxg:GridColumn.CellTemplate>
       <DataTemplate>
          <StackPanel>
             <Image ...>
             <Image ...>
             <Image ...>
          </StackPanel>
       </DataTemplate>
    </dxg:GridColumn.CellTemplate>
    

    Depending on the way you want it displayed, you can set the Orientation on the StackPanel to either Vertical or Horizontal.