I am currently using xaml and how do I insert dashed line at the bottom of every row in a grid tag. I was able to insert it one by one using the code below.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Line Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4"
X1="10" Y1="0"
X2="1270" Y2="0"
Stroke="White" StrokeDashArray="2, 2"
StrokeThickness="2" />
<Line Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4"
X1="10" Y1="0"
X2="1270" Y2="0"
Stroke="White" StrokeDashArray="2, 2"
StrokeThickness="2" />
<Line Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4"
X1="10" Y1="0"
X2="1270" Y2="0"
Stroke="White" StrokeDashArray="2, 2"
StrokeThickness="2" />
</Grid>
However, let's say if I have more than 50 rows in my grid and I wouldn't insert the line tag one by one. Is there a possible way to do it using grid.resource style tag?
let's say if I have more than 50 rows in my grid
That means you are doing something wrong. You should use any of ItemsControls in this case. If you really need Grid with 50 rows, you could add your dashed lines in a loop in CodeBehind. Assuming you are using MVVM, CodeBehind is still a proper place to modify GUI.