Skip to content

Commit

Permalink
Use Border instead of Frame to avoid layout issues in MAUI
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten committed Aug 7, 2023
1 parent ea96891 commit 89c3fc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ private void AddSymbol(Symbol symbol)
{
int columnCount = LayoutRoot.ColumnDefinitions.Count;
var sd = new SymbolDisplay() { Symbol = symbol };
Frame f = new Frame()
Border border = new Border()
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Padding = 0,
CornerRadius = 0
StrokeThickness = 1,
};
f.SetAppThemeColor(Microsoft.Maui.Controls.Frame.BorderColorProperty, Colors.Black, Colors.White);
f.Content = sd;
border.SetAppThemeColor(Microsoft.Maui.Controls.Border.StrokeProperty, Colors.Black, Colors.White);
border.Content = sd;
int count = LayoutRoot.Children.Count;
var row = count / columnCount;
var column = count % columnCount;
if (column == 0)
LayoutRoot.RowDefinitions.Add(new RowDefinition());
Grid.SetRow(f, row);
Grid.SetColumn(f, column);
LayoutRoot.Children.Add(f);
Grid.SetRow(border, row);
Grid.SetColumn(border, column);
LayoutRoot.Children.Add(border);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

</StackLayout>

<Frame BorderColor="LightGray" Grid.Row="1" Margin="20" HorizontalOptions="Center" VerticalOptions="Center" Padding="0" CornerRadius="0">
<Border Stroke="LightGray" Grid.Row="1" Margin="0" HorizontalOptions="Center" VerticalOptions="Center" Padding="0" >
<esri:SymbolDisplay x:Name="symbolDisplay" Symbol="{Binding Symbol}" />
</Frame>

</Border>

</Grid>
</ContentPage.Content>
</ContentPage>

0 comments on commit 89c3fc0

Please sign in to comment.