C# wpf - This code changes the entire ListView background:
<ListView x:Name="gLVwCities" Margin="5,0,5,0" Foreground="#ffffff"/>
public void FillListView(ListView LVw, List<string> liststX) { LVw.Items.Clear(); if (liststX.Count > 0) { for (int iii = 0; iii < liststX.Count; iii++) { string stName = liststX[iii]; LVw.Items.Add(stName); if (stName.Contains("blue")) LVw.Background = Brushes.Blue; else if (stName.Contains("yellow")) LVw.Background = Brushes.Yellow; else if (stName.Contains("black")) LVw.Background = Brushes.Black; else if (stName.Contains("red")) LVw.Background = Brushes.Red; } } }
How do I change the background color for every line in a ListView? Every ListView line background could be different ... one ListView line background could red, the next ListView line background could be blue.