Пример #1
0
        Native.FormattedString ConvertFormattedText(FormattedString formattedString)
        {
            if (formattedString == null)
            {
                return(null);
            }

            Native.FormattedString nativeString = new Native.FormattedString();

            foreach (var span in formattedString.Spans)
            {
                var textDecorations = span.TextDecorations;

                Native.Span nativeSpan = new Native.Span();
                nativeSpan.Text            = span.Text;
                nativeSpan.FontAttributes  = span.FontAttributes;
                nativeSpan.FontFamily      = span.FontFamily;
                nativeSpan.FontSize        = span.FontSize;
                nativeSpan.ForegroundColor = span.TextColor.ToNative();
                nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
                nativeSpan.Underline       = (textDecorations & TextDecorations.Underline) != 0;
                nativeSpan.Strikethrough   = (textDecorations & TextDecorations.Strikethrough) != 0;
                nativeSpan.LineHeight      = span.LineHeight;
                nativeString.Spans.Add(nativeSpan);
            }

            return(nativeString);
        }
 string SpanTitle(string Title)
 {
     Native.Span span = new Native.Span
     {
         Text = Title,
         HorizontalTextAlignment = Native.TextAlignment.Center,
         ForegroundColor         = Element.BarTextColor.ToNative()
     };
     return(span.GetMarkupText());
 }
Пример #3
0
        static Native.Span ToNative(Span span)
        {
            var nativeSpan = new Native.Span();

            nativeSpan.Text            = span.Text;
            nativeSpan.ForegroundColor = span.ForegroundColor.ToNative();
            nativeSpan.FontAttributes  = span.FontAttributes;
            nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
            nativeSpan.FontSize        = span.FontSize;
            nativeSpan.FontFamily      = span.FontFamily;
            return(nativeSpan);
        }
Пример #4
0
        Native.FormattedString ConvertFormattedText(FormattedString formattedString)
        {
            if (formattedString == null)
            {
                return(null);
            }

            Native.FormattedString nativeString = new Native.FormattedString();

            foreach (var span in formattedString.Spans)
            {
                Native.Span nativeSpan = new Native.Span();
                nativeSpan.Text            = span.Text;
                nativeSpan.FontAttributes  = span.FontAttributes;
                nativeSpan.FontFamily      = span.FontFamily;
                nativeSpan.FontSize        = span.FontSize;
                nativeSpan.ForegroundColor = span.ForegroundColor.ToNative();
                nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
                nativeString.Spans.Add(nativeSpan);
            }

            return(nativeString);
        }