summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>2017-06-12 10:31:00 +0200
committerSeungkeun Lee <sngn.lee@samsung.com>2017-06-27 01:34:44 +0000
commit48138ed738815e24e8affa01712973c8c825f725 (patch)
treef5fa0f4465b3f492910393b36ba25f211e559caf
parent154433956fe4392f1f2d9212f3a6b2e25e105053 (diff)
downloadxamarin-forms-48138ed738815e24e8affa01712973c8c825f725.tar.gz
xamarin-forms-48138ed738815e24e8affa01712973c8c825f725.tar.bz2
xamarin-forms-48138ed738815e24e8affa01712973c8c825f725.zip
Initialize Button with single batch update
Change-Id: Id34604e0d228b9d94395f432471ff272eb7e251f Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Button.cs12
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs8
2 files changed, 18 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Button.cs b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
index a3f36a4b..5985c58b 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Button.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// Extends the EButton control, providing basic formatting features,
/// i.e. font color, size, additional image.
/// </summary>
- public class Button : EButton, IMeasurable
+ public class Button : EButton, IMeasurable, IBatchable
{
/// <summary>
/// Holds the formatted text of the button.
@@ -192,12 +192,20 @@ namespace Xamarin.Forms.Platform.Tizen.Native
}
}
+ void IBatchable.OnBatchCommitted()
+ {
+ ApplyTextAndStyle();
+ }
+
/// <summary>
/// Applies the button's text and its style.
/// </summary>
void ApplyTextAndStyle()
{
- SetInternalTextAndStyle(_span.GetDecoratedText(), _span.GetStyle());
+ if (!this.IsBatched())
+ {
+ SetInternalTextAndStyle(_span.GetDecoratedText(), _span.GetStyle());
+ }
}
/// <summary>
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
index 97b07bb7..483fcebc 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.Forms.Platform.Tizen.Native;
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement;
namespace Xamarin.Forms.Platform.Tizen
@@ -37,6 +38,8 @@ namespace Xamarin.Forms.Platform.Tizen
if (e.NewElement != null)
{
Control.Clicked += ButtonClickedHandler;
+
+ Control.BatchBegin();
}
base.OnElementChanged(e);
}
@@ -46,6 +49,11 @@ namespace Xamarin.Forms.Platform.Tizen
return Control.Measure(Control.MinimumWidth, Control.MinimumHeight).ToDP();
}
+ protected override void OnElementReady()
+ {
+ Control?.BatchCommit();
+ }
+
void ButtonClickedHandler(object sender, EventArgs e)
{
IButtonController btn = Element as IButtonController;