在Xamarin.forms中的Label的Text属性部分应用斜体效果

Zac*_*ell 9 c# xamarin.ios xamarin xamarin.forms

这是我在Xamarin.forms中的片段.

grid.Children.Add (new Label {Text = "Italic, Bold",
                            XAlign = TextAlignment.Center,
                            YAlign = TextAlignment.Center,
                            FontSize = 30
                        }, 1, 1);
Run Code Online (Sandbox Code Playgroud)

我需要制作"Italic"Italic字体和大胆的"Bold".

谁能帮我?

Zac*_*ell 9

我解决了

var fs = new FormattedString ();
fs.Spans.Add (new Span { Text="Italic", ForegroundColor = Color.Gray, FontSize = 20, FontAttributes = FontAttributes.Italic });
fs.Spans.Add (new Span { Text=", Bold", ForegroundColor = Color.Gray, FontSize = 20, FontAttributes = FontAttributes.Bold });
labelFormatted.FormattedText = fs;
Run Code Online (Sandbox Code Playgroud)