Answered by:
Vertical lines in the GridView

Question
-
May be I am missing something, but I can't get the ListView with GridView to display vertical lines.
-Alex
Saturday, August 19, 2006 1:03 AM
Answers
-
LOL, I was trying to do the same thing last night-
It is not supported. Adding a border around each cell kinda works, that is until you resize a col....
Saturday, August 19, 2006 3:01 PM
All replies
-
LOL, I was trying to do the same thing last night-
It is not supported. Adding a border around each cell kinda works, that is until you resize a col....
Saturday, August 19, 2006 3:01 PM -
Hi,
Any samples showing work-arounds to achieve this? The "look" I want is a simple spreadsheet grid with crisp single line dividers horizontally and vertically.
Thanks
Saturday, January 27, 2007 2:22 AM -
There are two ways to do this.
The old way is to set the background color to the table to the color you want your grid lines to be. Set a cellspacing ="1" to the table tag and set a bacground color to all of your TDs. Voila, you will have a grid with a 1 pixel border on all cells!!
You can also accomplish this with css (preferred way):
In the table you need to add a css class, or a style attribute with "border-collapse: collapse;"
Then you need to add the following style attribute or class to each cell: "border: 1px solid gray"
you will get the same result. If you only want vertical lines then the style in the cell should be:
"border:1px solid gray; border-top-width: 0px; border-bottom-width:0px;"
I hope you find this information usefull, good luck!
AnastasiosSaturday, January 27, 2007 11:51 AM -
Hi Anastasios,
Thanks for the answer, but this is a Windows Presentation Foundation forum right? CSS and tables are HTML stuff. Or am I missing something?
AlexSaturday, January 27, 2007 11:31 PM -
(I'm partially answering my own question)
After some more searching in the forum I found this thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=254638&SiteID=1
Short answer: No stock gridlines in v1 of WPF(Hmmm... when will v2 be?
). A partial work-around is to use cell borders.
Alex
Sunday, January 28, 2007 6:57 AM -
I've found possible implementations of this in these two resources:
- http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/12/16/wpf-listview-vertical-lines-horizontal-as-bonus.aspx
- http://www.designerwpf.com/2007/12/11/how-do-i-set-up-grid-lines-for-my-listview/
I'm working through some more approaches as we speak, I'll let you know how it goes. Gridviews should have vertical lines, damnit
Monday, January 14, 2008 1:55 PM -
Anastasiosyal said:
There are two ways to do this.
The old way is to set the background color to the table to the color you want your grid lines to be. Set a cellspacing ="1" to the table tag and set a bacground color to all of your TDs. Voila, you will have a grid with a 1 pixel border on all cells!!
You can also accomplish this with css (preferred way):
In the table you need to add a css class, or a style attribute with "border-collapse: collapse;"
Then you need to add the following style attribute or class to each cell: "border: 1px solid gray"
you will get the same result. If you only want vertical lines then the style in the cell should be:
"border:1px solid gray; border-top-width: 0px; border-bottom-width:0px;"
I hope you find this information usefull, good luck!
Anastasios
Can you show the xaml example code of the css border collapse please?Thursday, January 29, 2009 4:40 PM