Hello,
Is it possible to configure Border so the it only draws a border on one side?
No, <Border>
cannot draw a border on one side.
However, you can use BoxView to draw it. For example, if you want to draw a bottom border. You can create a <VerticalStackLayout>
and put a BoxView (set HeightRequest
and HorizontalOptions="Fill"
) like following code.
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Label Text="This is test text"
FontSize="14"
FontAttributes="Bold" />
<BoxView
Color="Gray"
Margin="0,-10,0,0"
HeightRequest="2"
HorizontalOptions="Fill" />
</VerticalStackLayout>
If you want to draw a left border. Please create <HorizontalStackLayout >
, set BoxView
with WidthRequest
and VerticalOptions="Fill"
like following code.
<HorizontalStackLayout HeightRequest="20">
<BoxView
Color="Gray"
Margin="0,0,0,0"
WidthRequest="2"
VerticalOptions="Fill" />
<Label Text="This is test text"
FontSize="14"
FontAttributes="Bold"
/>
</HorizontalStackLayout>
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.