Does anyone know how to draw a line between two items in a grid? I would normally use a canvas but it does not provide the layout I want.

The grid is the ItemsPanel of an ItemControl object.



No correct solution


You have to do following things, Suppose you have three columns in the grid and one item is in the first column and second item is in the third column and you have to draw line between them. and I am supposing that all the columns of the grid has same width.

  1. Write style for the button which only contain the line.
  2. now set the left margin and right margin of the line ( which will be the button and style of the button , you have created as I have mention above), to the half size of the columns width, and set the columnSpan of the line button to 3.

Hope that will help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow