summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchungryeol lim <cdark.lim@samsung.com>2017-01-23 08:05:50 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-03-24 04:19:01 (GMT)
commit7af5b1f6a4f733db87e7998e10a75ad1cb8c9119 (patch)
tree86243937fbdcd218a6825a725fe5272922dce8f3
parent285f771231dff9528d6815753871cf02ea53b7e6 (diff)
downloadxamarin-forms-7af5b1f6a4f733db87e7998e10a75ad1cb8c9119.zip
xamarin-forms-7af5b1f6a4f733db87e7998e10a75ad1cb8c9119.tar.gz
xamarin-forms-7af5b1f6a4f733db87e7998e10a75ad1cb8c9119.tar.bz2
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 24e93bc..0f72379 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)