How to create image column and buttons in ListView in WPF

I need to add two columns to a ListView . One column shows different Image , and another column is used to display Button .

This will be great help if anyone provides any source code for a link or example. Thanks in advance.

+4
source share
1 answer

This will give you two columns with one button with an image. if I did this, I would put the command on my element so that I could attach my button to it.

  <ListView Name="myListView"> <ListView.View> <GridView> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <Button Content="Click Me" Margin="0" VerticalAlignment="Center" Click="Button_Click" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <Image Source="{Binding ImageSource}" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView> 

You will need to have a source of elements containing elements that have the ImageSource property

+10
source

All Articles