Maui android label text property problem issue

Haviv Elbsz 2,071 Reputation points
2024-01-03T06:35:08.5333333+00:00

Hello all.

Maui Ver 17.9 preview 2 Android Ver 34.

In my app I have a label with the property Text problem (label.txt = string)

as shown in the following code:

    private void ShowText()
    {
       
       if(String.IsNullOrEmpty(pattern))
        {
            OutputText.Text += "\nNeed Input\n"; // This work OK
            return;
        }

        try
        {
            re = new Regex(pattern, options);
        }
        catch (ArgumentException ex)
        {
            OutputTex.Text += "RROR " + "\n" + "\n" + ex.ToString();// This NOT work
            return;
        }

    }

    // Note that in some place in the app I use this code

    XformattedString.Spans.Add(new Span { Text = yString });
    OutputText.FormattedText = XformattedString;

    
// Please any help for resolve this problem as shown
// commented ( //... ) in the //above code.

// Thank you.

I found this see link and picture.

What the remarks mean and how I can set a string to Text property.

label text property

https://learn.microsoft.com/en-us/dotnet/api/microsoft.maui.controls.label.text?view=net-maui-8.0

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,900 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Haviv Elbsz 2,071 Reputation points
    2024-01-07T14:30:41.17+00:00

    Hi Liu. I want to update you that I built a new app that contains the relevant issue and is working ok. now I will to eliminate and try until I found the segment in my app that prevent this to run ok. sorry about the upset I caused to you. Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.