I have an app in which you’re supposed to get coordinates from Google maps by moving the map to the coordinates and pressing next. In order to show where the map is pointing there’s a black rectangle in the middle, which I need to turn into a small dot.
Originally the frame was a black rectangle with width and height set to 8. So I made it red, set the WidthRequest and HeightRequest to 1, and gave it a radius like so
<Frame
BackgroundColor="Red"
Opacity="1"
WidthRequest="0.01"
HeightRequest="0.01"
CornerRadius="20"
InputTransparent="True"
HorizontalOptions="Center"
VerticalOptions="Center"
/>
Which gives this circle:
Which isn’t exactly a small circle. Setting the Width and Height requests to less than 1 gives them the same size as 1, even though they’re double.
The full code is this. I didn’t make it, and if there are better ways to do this I am open to suggestions
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ctrl="clr-namespace:DriverReporting.CustomControls"
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
x:Class="DriverReporting.Views.ManualMapPage"
Title="{Binding DisplayedValue}">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Næste" Command="{Binding CommitCommand}" />
</ContentPage.ToolbarItems>
<Grid HorizontalOptions="Fill" VerticalOptions="Fill">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<ctrl:MapControl
Grid.RowSpan="2" x:Name="MapControl"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
CameraPosition="{Binding Value}"
InitialPosition="{Binding InitialLocation}"
/>
<Frame
BackgroundColor="Red"
Opacity="1"
WidthRequest="0.01"
HeightRequest="0.01"
CornerRadius="20"
InputTransparent="True"
HorizontalOptions="Center"
VerticalOptions="Center"
/>
</Grid>
</ContentPage>