How would I set a custom grid line style on just one column of a DataGrid? In particular, I’d like one column to have a double line as its left border.
Example:
| Col1 | Col2 || Col3 (w/ Double Left Border) |
Thank you,
Ben
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on where you want this double line. The vertical GridLines is drawn in
OnRenderforDataGridCelland the horizontal GridLines is drawn inOnRenderforDataGridCellsPresenter. The border for theDataGridColumnHeaderis more complicated however. It’s a Rectangle that’s drawn in theRenderThememethod inDataGridHeaderBorderand I don’t think that there is a direct way to change its width without re-templating the entireDataGridColumnHeader. Also, the border thickness for the Headers are twice as thick as the Cells in theDataGridto begin with (1px vs 2px), because the Headers draw their Separators on both sides.So, to get double line thickness which just affects the Cells you can add a special
DataGridCellstyle where you want this to apply. All this cellstyle does is to draw a 1px border to the left in the same colour as the GridLines. It’ll look something like thisThere is no mouseover effect or anything on the cells to worry about. If you do something similar for a
DataGridColumnHeaderhowever, you’ll lose the sorting arrows, mouseover effect, mousedown effect etc. so a you’ll have to create an entire template for it