Home

Awesome

Stroked Labels

NuGet
Nuget
Publish To Nuget

image

Platforms:

Quick start

Add the above nuget package to your Maui project

dotnet add package Vapolia.StrokedLabel

then add this line to your maui app builder:

using Vapolia.StrokedLabels;
...
builder.UseStrokedLabelBehavior();

Usage

Declare the namespace:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         ...
         xmlns:stroked="https://vapolia.eu/Vapolia.StrokedLabel">

Apply the behavior to a label:

<Label Text="I do really like it!"
       FontSize="32"
       TextColor="LightBlue"
       stroked:StrokedLabel.StrokeColor="DarkBlue"
       stroked:StrokedLabel.StrokeWidth="4"  />

Or apply the behavior through a style:

<StackLayout>
    <StackLayout.Resources>
        <Style TargetType="Label">
            <Setter Property="TextColor" Value="LightBlue" />
            <Setter Property="stroked:StrokedLabel.StrokeColor" Value="DarkBlue" />
            <Setter Property="stroked:StrokedLabel.StrokeWidth" Value="4" />
        </Style>
    </StackLayout.Resources>

    <Label FontSize="32" Text="I like it so much!" />
</StackLayout>

Examples

See the SampleApp in this repo.

Limitations

This behavior is working only with the Label's Text property. It does not work with the FormattedText property (nor Spans). An implementation could be made in the future by using that code on android.