In this article, I will teach you, how to change Background color, foreground color, font style, and many more things. I explained already many more things about WPF Listview like
- How to add items in it using XAML code
- How to bind the WPF Listview.view from Gridview.
- WPF Listview binding from EDMX file
- Binding it with List of string type.
Also covered many more articles, which is related to styling and formatting. You can see my video article for Learn WPF styling using static as well as dynamic. Today, I will put some styles in XAML code. Let's see
Code generates the following output
<ListView Name="list1" HorizontalAlignment="Left" VerticalAlignment="Top">
<ListViewItem FontFamily="Times New Roman" FontSize="15" Foreground="Red" Background="Green" BorderBrush="AliceBlue" BorderThickness="2">Apple</ListViewItem>
<ListViewItem FontSize="16" Foreground="Green" Background="orange" BorderBrush="AliceBlue" BorderThickness="2">Orange</ListViewItem>
<ListViewItem FontSize="17" Foreground="Red" Background="White" BorderBrush="AliceBlue" BorderThickness="2">Pea</ListViewItem>
<ListBoxItem>
</ListBoxItem>
</ListView>
Code generates the following output