Home > DeveloperSection > Forums > How to set row border and background color in WPF Grid
ben reitman
ben reitman

Total Post:96

Points:676
Posted on    September-24-2013 8:43 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 3872  View(s)
Rate this:

How can we set border and background colour in the WPF grid control ,

i am creating rows and column dynamically and adding then to grid,can we set colour and border from the code behind?



Pravesh Singh

Total Post:411

Points:2881
Posted on    September-24-2013 9:02 AM

Hi Ben,

The Background color can just be set for the entire Grid by using the Background property:

<Grid Background="Red" />

Or if you want it set for individual cells, you need to add an element to the cell that has its Background property set.

As for Borders, a Grid only contains the ShowGridLines property, which can be used to show thin dotted lines that cannot be styled.

Don't want to miss updates? Please click the below button!

Follow MindStick