Hello fellow Xamarin Forms users,
I already found out that borders on a label are not supported out of the box by Xamarin Froms. So after some searching is still have no clue how to make it possible. Is it possible to add a border using the custom renderer? If so does someone have an example? and if not does someone have any other out of the box idea to make this possible.
Thank you in advance
You can add a Label
within Frame
element, and setup OutlineColor
for Frame
:
<Frame OutlineColor="Black">
<Label Text="My Label With Frame" />
</Frame>
If you want to use custom renderer, you should implement custom renderer for each platform you want to support (i.e. Android, iOS, UWP, WinPhone)
I was thinking a little out of the box and came up with using a boxview to use as a border. Here you have a sample of the code that I wrote:
<StackLayout x:Name="BasicInfo" Margin="10,10,10,5" Grid.Row="0" Grid.Column="0">
<Label Text="Basic Info" FontSize="20"/>
<BoxView Color="Black" WidthRequest ="100" HeightRequest="1"/>
<Label x:Name="text1" />
<Label x:Name="text2"/>
<Label x:Name="text3"/>
<Label x:Name="text4"/>
</StackLayout>
I'll also add a picture of the result it gives me:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With