WPF 自定义柱状图

		
            
    
        
            
                
                    
                
            
        
        
            
        
    


            listboxSource.Add(new ReptClass() { count = 16, mouth = "一月", color = Brushes.Blue });
            listboxSource.Add(new ReptClass() { count = 18, mouth = "二月", color = Brushes.Silver });
            listboxSource.Add(new ReptClass() { count = 24, mouth = "三月", color = Brushes.SeaGreen });
            listboxSource.Add(new ReptClass() { count = 15, mouth = "四月", color = Brushes.SlateBlue });
            listboxSource.Add(new ReptClass() { count = 10, mouth = "五月", color = Brushes.SeaShell });
            listboxSource.Add(new ReptClass() { count = 30, mouth = "六月", color = Brushes.SandyBrown });
            listboxSource.Add(new ReptClass() { count = 28, mouth = "七月", color = Brushes.SteelBlue });
            listboxSource.Add(new ReptClass() { count = 29, mouth = "八月", color = Brushes.SlateGray });
            listboxSource.Add(new ReptClass() { count = 16, mouth = "一月", color = Brushes.Blue });
            listboxSource.Add(new ReptClass() { count = 18, mouth = "二月", color = Brushes.Silver });
            listboxSource.Add(new ReptClass() { count = 24, mouth = "三月", color = Brushes.SeaGreen });
            listboxSource.Add(new ReptClass() { count = 15, mouth = "四月", color = Brushes.SlateBlue });
            listboxSource.Add(new ReptClass() { count = 10, mouth = "五月", color = Brushes.SeaShell });
            listboxSource.Add(new ReptClass() { count = 30, mouth = "六月", color = Brushes.SandyBrown });
            listboxSource.Add(new ReptClass() { count = 28, mouth = "七月", color = Brushes.SteelBlue });
            listboxSource.Add(new ReptClass() { count = 29, mouth = "八月", color = Brushes.SlateGray });
            LSRept.ItemsSource = listboxSource;



    //数据类
    public class ReptClass
    {
        public int count { set; get; }//数量
        public Brush color { set; get; }//颜色
        public string mouth { set; get; }//月份
        public int height { get { return count * 3; } }//高度
    }


你可能感兴趣的:(WPF,XAML)