We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cell Borders (Order of Precendence)

I have a cell where I want the top border to be black (solid line) and the left border to be a grey (solid line).

This functionality works except I want the black line (top) to override the actual red line (left) in the upper left corner of the cell (position 1,1) ... Is this possible?

What it comes down to is order of precendence in the drawing of the borders. If this is not achievable does anyone know of any other techniques I may use to do this?

Thanks.

3 Replies

AD Administrator Syncfusion Team September 14, 2006 04:24 AM UTC

Hi Mark ,

The GridStyleInfoAtWork (\Syncfusion\Essential Studio\4.2.0.37\ windows\ Grid.Windows\ Samples\ Quick Start\GridStyleInfoAtWork\ ) browser sample shows you the relationship between a standard style, the table style, a basestyle, a row style, a column style and a cell style. It lets you set a border for each one of these, and lets you choose whether or not you want the style included. While working with these options, you will be able to see the precedence relationship among the style. You can use the below code snippet to achieve this.

this.grid.TableStyle.Borders.Top = new GridBorder(GridBorderStyle.Solid,Color.Black);
this.grid.TableStyle.Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Gray);

this.grid[1,1].Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Red);
this.grid[1,1].Borders.Right = new GridBorder(GridBorderStyle.Solid,Color.Red);
this.grid[1,1].Borders.Bottom = new GridBorder(GridBorderStyle.Solid,Color.Red);

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GridBorders_96160866.zip

Let me know if this helps.

Best Regards,
Haneef



AD Administrator Syncfusion Team September 14, 2006 12:31 PM UTC

Hi,

Thanks for the example.

I ran it but it does not solve the problem. If you look at the grid produced it has the black line at the top of the cell but the first pixel is overridden with the vertical line of the left border (which is red)... this is the behaviour that I wish to override. I want the first pixel of the cell to be black (which should come from the top border).

Is this possible?

Mark

>Hi Mark ,

The GridStyleInfoAtWork (\Syncfusion\Essential Studio\4.2.0.37\ windows\ Grid.Windows\ Samples\ Quick Start\GridStyleInfoAtWork\ ) browser sample shows you the relationship between a standard style, the table style, a basestyle, a row style, a column style and a cell style. It lets you set a border for each one of these, and lets you choose whether or not you want the style included. While working with these options, you will be able to see the precedence relationship among the style. You can use the below code snippet to achieve this.

this.grid.TableStyle.Borders.Top = new GridBorder(GridBorderStyle.Solid,Color.Black);
this.grid.TableStyle.Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Gray);

this.grid[1,1].Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Red);
this.grid[1,1].Borders.Right = new GridBorder(GridBorderStyle.Solid,Color.Red);
this.grid[1,1].Borders.Bottom = new GridBorder(GridBorderStyle.Solid,Color.Red);

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GridBorders_96160866.zip

Let me know if this helps.

Best Regards,
Haneef



DW Dave Wilkins May 4, 2007 05:16 PM UTC

I have this problem too. I want to "underline" an entire grid row in a color (Yellow). But it looks like the vertical border (Gray) of each cell is drawn after the horizontal border, so the yellow line ends up broken on each column boundary - Yuck! It seems to be an order of precendence issue as Mark said. Any ideas?

>I have a cell where I want the top border to be black (solid line) and the left border to be a grey (solid line).

This functionality works except I want the black line (top) to override the actual red line (left) in the upper left corner of the cell (position 1,1) ... Is this possible?

What it comes down to is order of precendence in the drawing of the borders. If this is not achievable does anyone know of any other techniques I may use to do this?

Thanks.

Loader.
Live Chat Icon For mobile
Up arrow icon