-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainPage.xaml.cs
More file actions
35 lines (32 loc) · 905 Bytes
/
MainPage.xaml.cs
File metadata and controls
35 lines (32 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace MauiAppBoldTest
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private void Button1_Clicked(object sender, EventArgs e)
{
this.Title = GetLabelText(Label1);
}
private void Button2_Clicked(object sender, EventArgs e)
{
this.Title = GetLabelText(Label2Span);
}
public static string GetLabelText(Label lbl)
{
if (lbl.FormattedText != null)
{
// La label usa FormattedText (Span)
string composedText = string.Concat(lbl.FormattedText.Spans.Select(s => s.Text));
return composedText;
}
else
{
// La label usa Text semplice
return lbl.Text;
}
}
}
}