Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear label formatted text on tear down #13

Open
domneedham opened this issue Apr 30, 2024 · 1 comment
Open

Clear label formatted text on tear down #13

domneedham opened this issue Apr 30, 2024 · 1 comment

Comments

@domneedham
Copy link

If a label uses spans in the formatted string, it doesn't seem to register it as children on the element.

<Label
    MaxLines="2"
    LineBreakMode="WordWrap"
    VerticalOptions="Center">

    <Label.FormattedText>
        <FormattedString>
            <Span Text="Text One" />

            <!--Add blank space between normal text and link text-->
            <Span Text=" " />

            <Span Text="Text Two" TextDecorations="Underline">
                <Span.GestureRecognizers>
                    <TapGestureRecognizer Command="{Binding CommandHere}" />
                </Span.GestureRecognizers>
            </Span>
        </FormattedString>
    </Label.FormattedText>
</Label>

Therefore, the spans are not getting cleared in TearDownImpl.

Adding the following seems to work.

if (vte is Label label)
{
    if (label.FormattedText != null)
    {
        TearDownImpl(label.FormattedText);
    }
}

Happy to discuss further if required.

@AdamEssenmacher
Copy link
Owner

Agreed. PR or I'll try to get to it when I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants