From 3ee1beef9bd0c56a871a3ff9561632c4ed80e2d0 Mon Sep 17 00:00:00 2001
From: Piotr Czaja
Date: Tue, 3 Jan 2017 14:32:08 +0100
Subject: [Page] Change alert dialog message text wrap type
Note:
Alert dialog message text was not wrapped, so long strings did not
fit on the screen.
Change-Id: I820a262888969ae97e45e0b4a57d683b44a8322d
Signed-off-by: Piotr Czaja
---
Xamarin.Forms.Platform.Tizen/FormsApplication.cs | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
mode change 100644 => 100755 Xamarin.Forms.Platform.Tizen/FormsApplication.cs
diff --git a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
old mode 100644
new mode 100755
index fe8c4fd5..806f6a81
--- a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
+++ b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
@@ -165,17 +165,33 @@ namespace Xamarin.Forms.Platform.Tizen
MessagingCenter.Subscribe(this, Page.AlertSignalName, delegate (Page sender, AlertArguments arguments)
{
Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow);
-
alert.Title = arguments.Title;
var label = new ELabel(alert)
{
Text = "" + arguments.Message + "<\\span>",
};
+
label.Show();
var box = new Box(alert);
- box.PackEnd(label);
box.Show();
+
+ bool labelAdded = false;
+ box.Resized += (s, e) =>
+ {
+ label.LineWrapType = WrapType.Word;
+ //set 2% padding for alert text message width
+ label.LineWrapWidth = (int)Math.Round(box.Geometry.Width * 0.98);
+ if (!labelAdded)
+ {
+ /*Adding label to the box (box.PackEnd(label)) has been placed in box.Resized()
+ event due to get better performance. For some reason (probably EFL bug) when
+ it's placed outside of it, box.Resized() event is called far too many times.*/
+ box.PackEnd(label);
+ labelAdded = true;
+ }
+ };
+
alert.Content = box;
Native.Button cancel = new Native.Button(alert) { Text = arguments.Cancel };
--
cgit v1.2.3