How to set row border and background color in WPF Grid

Total Post:96

Points:676
WPF 
WPF
 7138  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. 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.

      Modified On Mar-31-2018 01:55:10 AM

Answer