How to set row border and background color in WPF Grid

后端 未结 2 1524
花落未央
花落未央 2020-12-30 01:11

How can we set border and background color in the WPF grid control ,
i am creating rows and column dynamically and adding then to grid,
can we set color and border fr

2条回答
  •  孤城傲影
    2020-12-30 01:51

    Here is a bit of a hack that seems to work well. If you place a background element in the rows / columns along with the elements you normally would place there, it will act as a background. You'll just need to mind the ordering of the elements in the XAML (the elements appear in increasing Z-Order), or set the Panel.Zorder accordingly.

    
    
        
            
            
            
        
        
            
            
        
            
                    
                   
            
            
            
            
            
        
    
    

    It looks like this:

    enter image description here

提交回复
热议问题