Good evening, welcome to WPF programming. I already explained, how to bind WPF listview from string type list also explained binding it with database table using EDMX file. In this article, I will give you an example of cell template of Gridview, which is inside in WPF Listview. You can say, I will update previous WPF listview article. If you want to customize your Gridview cell in WPF Listview control then use cell template.
Note: Before doing this task, read previous
You need to change only XAML file without any changes in code behind code. The previous XAML code is:
<Grid>
<ListView Name="listgrid"><ListView.View>
<GridView>
<GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Emp_Name}"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
Now, replace it with below-mentioned code
<Grid>
<ListView Name="listgrid"><ListView.View>
<GridView>
<GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/>
<GridViewColumn Header="Name">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Emp_Name}" FontWeight="Bold"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</Grid>
</ListView>
Now, codes generate the following output: