diff options
author | chungryeol lim <cdark.lim@samsung.com> | 2017-01-23 16:06:08 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-02-03 13:28:05 +0900 |
commit | 0ffd74b83f6383f803551940f105122844da6939 (patch) | |
tree | 7f38a62546bacd98e816517117c0969623ec61ce | |
parent | e410cc2eb213ad2b20021b24c98c385fee27f375 (diff) | |
download | xamarin-forms-0ffd74b83f6383f803551940f105122844da6939.tar.gz xamarin-forms-0ffd74b83f6383f803551940f105122844da6939.tar.bz2 xamarin-forms-0ffd74b83f6383f803551940f105122844da6939.zip |
Fixed Label.FormattedText property issue
- Text color is not set when it is FormattedText
- Task=TCAPI-2205
Change-Id: I16796fa52b73c87da7fcbc5c3517adb3e47c9684
Signed-off-by: chungryeol lim <cdark.lim@samsung.com>
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs index d21d3d76..24e93bca 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs @@ -54,17 +54,25 @@ namespace Xamarin.Forms.Platform.Tizen Native.FormattedString nativeString = new Native.FormattedString(); - foreach (var element in formattedString.Spans) + foreach (var span in formattedString.Spans) { - Native.Span span = new Native.Span(); - span.FormattedText = element.Text; - span.FontAttributes = element.FontAttributes; - span.FontFamily = element.FontFamily; - span.FontSize = element.FontSize; - span.ForegroundColor = element.ForegroundColor.IsDefault ? s_defaultForegroundColor : element.ForegroundColor.ToNative(); - span.BackgroundColor = element.BackgroundColor.IsDefault ? s_defaultBackgroundColor : element.BackgroundColor.ToNative(); - - nativeString.Spans.Add(span); + Native.Span nativeSpan = new Native.Span(); + nativeSpan.FormattedText = span.Text; + nativeSpan.FontAttributes = span.FontAttributes == FontAttributes.None ? Element.FontAttributes : span.FontAttributes; + nativeSpan.FontFamily = span.FontFamily == null ? Element.FontFamily : span.FontFamily; + nativeSpan.FontSize = span.FontSize == Device.GetNamedSize(NamedSize.Default, typeof(Label), true) ? Element.FontSize : span.FontSize; + + if (span.ForegroundColor.IsDefault) + nativeSpan.ForegroundColor = Element.TextColor.IsDefault ? s_defaultForegroundColor : Element.TextColor.ToNative(); + else + nativeSpan.ForegroundColor = span.ForegroundColor.ToNative(); + + if (span.BackgroundColor.IsDefault) + nativeSpan.BackgroundColor = Element.BackgroundColor.IsDefault ? s_defaultBackgroundColor : Element.BackgroundColor.ToNative(); + else + nativeSpan.BackgroundColor = span.BackgroundColor.ToNative(); + + nativeString.Spans.Add(nativeSpan); } return nativeString; |