wpf – ListView交替背景色
?在ListView上使用该style
And you will need to apply that style on the ListView.
public class MainWindowViewModel { #region Fields private List<Customer> _customers; #endregion Fields #region Contructors public MainWindowViewModel() { Initialize(); } #endregion Constructors #region Methods public void Initialize() { _customers = new List<Customer>() { new Customer() { Name = "Joe", Address = "Hanhua", Age = 12, }, new Customer() { Name = "Nora", Address = "Hanhua", Age = 32, }, new Customer() { Name = "Karl", Address = "Huaihai", Age = 12, }, new Customer() { Name = "Summer", Address = "Huaihai", Age = 24, }, }; } #endregion Methods public CollectionView Customers { get { return new CollectionView(_customers); } } ?
References:
How to : Alternate the Background Color for rows in a ListView.?http://msdn.microsoft.com/en-us/library/ms750769(v=vs.85).aspx
?