WPF: Alternating colors on a ItemsControl?

后端 未结 3 937
無奈伤痛
無奈伤痛 2020-12-06 04:07

How do I get alternating colors on a ItemsControl? I have AlternationCount set to 2, but the ItemsControl.AlternationIndex property always returns 0.

                


        
3条回答
  •  悲哀的现实
    2020-12-06 04:43

    Check here http://www.codeproject.com/Articles/35886/WPF-ItemsControl-with-alternating-items-and-hover-.aspx

    You have to change your code like this to get it working

        
            
                
                                        
                       ----------------------------
                       ----------------------------
                    
                    
                        
                            
                        
                        
                            
                        
                    
                
            
    

提交回复
热议问题