HOW TO SET ROW BORDER AND BACKGROUND COLOR IN WPF GRID

ben reitman

Total Post:96

Points:676
Posted by  ben reitman
WPF 
WPF
 5974  View(s)
Ratings:
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?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: How to set row border and background color in WPF Grid

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!