How can I change the color of the gridlines of a Grid in WPF?

后端 未结 5 373
陌清茗
陌清茗 2020-12-15 17:17

I have a Grid (not a DataGrid, but a real Grid), with GridLines set to True. How can I change the color of the gridlines? Hardcoded in

5条回答
  •  执笔经年
    2020-12-15 17:47

    This answer is not how to actually change the GridLines, but how to make it look like you did in a very simple way. I am sure others have better ways to do this, but here is how I accomplished showing my gridlines.

    
                                    
                                        
                                        
                                         
                                    
                                    
                                    
                                                          
                                    
                                            
                                    
                                
    

    Create a border for your column definitions or grid definitions and set the Grid.Column property to whatever you wish. Then you can set your color, thickness, or style. Sweet and simple. Hope this helps someone else!

    Here is an image of this grid:

    enter image description here

提交回复
热议问题