summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchungryeol lim <cdark.lim@samsung.com>2017-01-23 17:05:50 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-04-24 13:36:51 +0900
commite5582e656506f7ea2a385616d89c9bed53f03f28 (patch)
treece526f5045b549a563ba9c39aaebb16c105ddff5
parenta38b817f6dc78322ad1629321dbef8d23c63cb6e (diff)
downloadxamarin-forms-e5582e656506f7ea2a385616d89c9bed53f03f28.tar.gz
xamarin-forms-e5582e656506f7ea2a385616d89c9bed53f03f28.tar.bz2
xamarin-forms-e5582e656506f7ea2a385616d89c9bed53f03f28.zip
Fixed Label.HorizontalTextAlignment issue
- HorizontalTextAlignment is not working for Label - Task=TCAPI-2201 Change-Id: I6bb509a865a57c774f3de4d43fff8e90cc7c90ca Signed-off-by: chungryeol lim <cdark.lim@samsung.com>
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
index 24e93bca..0f723790 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
@@ -18,7 +18,7 @@ namespace Xamarin.Forms.Platform.Tizen
RegisterPropertyHandler(Label.LineBreakModeProperty, UpdateLineBreakMode);
RegisterPropertyHandler(Label.HorizontalTextAlignmentProperty, UpdateTextAlignment);
RegisterPropertyHandler(Label.VerticalTextAlignmentProperty, UpdateTextAlignment);
- RegisterPropertyHandler(Label.FormattedTextProperty, () => Control.FormattedText = ConvertFormattedText(Element.FormattedText));
+ RegisterPropertyHandler(Label.FormattedTextProperty, UpdateFormattedText);
}
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
@@ -61,6 +61,8 @@ namespace Xamarin.Forms.Platform.Tizen
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;
+ nativeSpan.LineBreakMode = Control.LineBreakMode;
+ nativeSpan.HorizontalTextAlignment = Control.HorizontalTextAlignment;
if (span.ForegroundColor.IsDefault)
nativeSpan.ForegroundColor = Element.TextColor.IsDefault ? s_defaultForegroundColor : Element.TextColor.ToNative();
@@ -78,15 +80,23 @@ namespace Xamarin.Forms.Platform.Tizen
return nativeString;
}
+ void UpdateFormattedText()
+ {
+ if(Element.FormattedText != null)
+ Control.FormattedText = ConvertFormattedText(Element.FormattedText);
+ }
+
void UpdateTextColor()
{
Control.TextColor = Element.TextColor.IsDefault ? s_defaultTextColor : Element.TextColor.ToNative();
+ UpdateFormattedText();
}
void UpdateTextAlignment()
{
Control.HorizontalTextAlignment = Element.HorizontalTextAlignment.ToNative();
Control.VerticalTextAlignment = Element.VerticalTextAlignment.ToNative();
+ UpdateFormattedText();
}
void UpdateFontProperties()
@@ -94,11 +104,13 @@ namespace Xamarin.Forms.Platform.Tizen
Control.FontSize = Element.FontSize;
Control.FontAttributes = Element.FontAttributes;
Control.FontFamily = Element.FontFamily;
+ UpdateFormattedText();
}
void UpdateLineBreakMode()
{
Control.LineBreakMode = ConvertToNativeLineBreakMode(Element.LineBreakMode);
+ UpdateFormattedText();
}
Native.LineBreakMode ConvertToNativeLineBreakMode(LineBreakMode mode)