---
title: "How to set row border and background color in WPF Grid"  
description: "How to set row border and background color in WPF Grid"  
author: "Anonymous User"  
published: 2013-09-24  
updated: 2013-09-24  
canonical: https://www.mindstick.com/forum/1523/how-to-set-row-border-and-background-color-in-wpf-grid  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# How to set row border and background color in WPF Grid

How can we set border and [background](https://www.mindstick.com/articles/65/how-to-change-background-color-of-tab-control-in-c-sharp) colour in the [WPF](https://www.mindstick.com/forum/304/wpf) [grid](https://www.mindstick.com/forum/369/how-can-i-add-a-column-name-to-my-grid) [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) ,

i am creating rows and [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) dynamically and adding then to grid,can we set colour and border from the [code behind](https://www.mindstick.com/forum/2199/call-javascript-s-function-from-code-behind)?

## Replies

### Reply by Pravesh Singh

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.


---

Original Source: https://www.mindstick.com/forum/1523/how-to-set-row-border-and-background-color-in-wpf-grid

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
