A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
Hello @Haviv Elbsz !
The issue you're experiencing is likely due to the way the BoxView elements are being rendered within the Grid. Here are some potential causes I can give:
- StrokeThickness of Border Elements: The
Borderelements you defined have aStrokeThicknessof 0, which is fine for the borders around the labels. However the thick lines seem to come from theBoxViewelements used for the grid lines. - BoxView Size: The
BoxViewelements for the background rows and columns are spanning the entire height and width of the grid due toGrid.SetRowSpanandGrid.SetColumnSpan. This can cause them to appear as thick blocks rather than thin lines. The default size of aBoxViewis based on its container, and without explicit sizing, it may fill the available space. - Layout Options: The commented-out
HorizontalOptionsandVerticalOptions(set toLayoutOptions.Fill) might have been an attempt to control this, but they need to be uncommented and adjusted properly.
To achieve thin vertical lines, you should Set a specific width for the BoxView elements used as vertical lines (e.g., 1 unit) instead of letting them span the full height. Then ensure the BoxView elements for horizontal lines have a specific height, try to remove or adjust the RowSpan and ColumnSpan for the BoxView elements to prevent them from filling the entire grid.
Here's an example for relevant part in your PopulateGuessFieldsGrid method:
for (int col = 0; col < guessFieldsGrid.ColumnDefinitions.Count; col += 2)
{
var backgroundColumn = new BoxView
{
Color = Colors.Black,
WidthRequest = 1, // Thin vertical line
VerticalOptions = LayoutOptions.Fill
};
Grid.SetRow(backgroundColumn, 0);
Grid.SetRowSpan(backgroundColumn, guessFieldsGrid.RowDefinitions.Count);
Grid.SetColumn(backgroundColumn, col);
guessFieldsGrid.Children.Add(backgroundColumn);
}
for (int row = 0; row < guessFieldsGrid.RowDefinitions.Count; row += 2)
{
var backgroundRow = new BoxView
{
Color = Colors.Black,
HeightRequest = 1, // Thin horizontal line
HorizontalOptions = LayoutOptions.Fill
};
Grid.SetColumn(backgroundRow, 0);
Grid.SetColumnSpan(backgroundRow, guessFieldsGrid.ColumnDefinitions.Count);
Grid.SetRow(backgroundRow, row);
guessFieldsGrid.Children.Add(backgroundRow);
}
- Ensure the
Gridis properly sized within theScrollViewandVerticalStackLayout. The nestedScrollView(one for horizontal and one for vertical) might also affect the layout. Consider simplifying to a singleScrollViewif possible or ensure the innerScrollViewhas appropriate constraints. - Test the layout on different screen sizes to confirm the lines remain thin and consistent.
Try this adjustment and let me know if you still encounter issues!