You can put Line
at the top of the required cells by setting VerticalAlignment="Top"
corresponding to Grid.ColumnSpan
and setting StrokeDashArray
to get a dashed line.
Edit: The above was just out of my head, and I obviously forgot about a few "features" of WPF.
Here is the sample I received. I put it in a grid with 5 rows and columns the size of a star.
<Line Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2" VerticalAlignment="Center" Stroke="Black" StrokeThickness="1" X2="{Binding Path=ActualWidth, RelativeSource={RelativeSource Self}}" /> <Line Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" Grid.ColumnSpan="2" VerticalAlignment="Center" Stroke="Black" StrokeThickness="2" StrokeDashArray="5,3" X2="{Binding Path=ActualWidth, RelativeSource={RelativeSource Self}}" />
Note. If the lines are different in size, this will not work, because it centers the line in two lines. If they vary in size, you will need VerticalAlignment="Top"
, but be careful, the top half of the line will be cut off.
source share