summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-01-09 08:12:14 (GMT)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-01-09 08:12:14 (GMT)
commit93062b9059a5f2891e087f77353648dc37e92bd6 (patch)
treeb911ee6d148f03b8a44a7367af12b15694e22c78 /Xamarin.Forms.Platform.Tizen
parent528f14b38dbe3543249e5a4a22974fbf69964373 (diff)
parentf4e3f04d5d689f28997d16cbe62389108e3398b8 (diff)
downloadxamarin-forms-93062b9059a5f2891e087f77353648dc37e92bd6.zip
xamarin-forms-93062b9059a5f2891e087f77353648dc37e92bd6.tar.gz
xamarin-forms-93062b9059a5f2891e087f77353648dc37e92bd6.tar.bz2
Merge "Support BlendColor to Image as a TizenSpecific API" into tizen
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs45
1 files changed, 42 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs
index ca06a66..09353b2 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs
@@ -1,15 +1,15 @@
+using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;
+using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Image;
+
namespace Xamarin.Forms.Platform.Tizen
{
public class ImageRenderer : ViewRenderer<Image, Native.Image>
{
public ImageRenderer()
{
- RegisterPropertyHandler(Image.SourceProperty, UpdateSource);
- RegisterPropertyHandler(Image.AspectProperty, UpdateAspect);
- RegisterPropertyHandler(Image.IsOpaqueProperty, UpdateIsOpaque);
}
protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
@@ -20,9 +20,35 @@ namespace Xamarin.Forms.Platform.Tizen
SetNativeControl(image);
}
+ if (e.NewElement != null)
+ {
+ UpdateAll();
+ }
+
base.OnElementChanged(e);
}
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ base.OnElementPropertyChanged(sender, e);
+ if (e.PropertyName == Image.SourceProperty.PropertyName)
+ {
+ UpdateSource();
+ }
+ else if (e.PropertyName == Image.AspectProperty.PropertyName)
+ {
+ UpdateAspect();
+ }
+ else if (e.PropertyName == Image.IsOpaqueProperty.PropertyName)
+ {
+ UpdateIsOpaque();
+ }
+ else if (e.PropertyName == Specific.BlendColorProperty.PropertyName)
+ {
+ UpdateBlendColor();
+ }
+ }
+
async void UpdateSource()
{
ImageSource source = Element.Source;
@@ -49,6 +75,19 @@ namespace Xamarin.Forms.Platform.Tizen
{
Control.IsOpaque = Element.IsOpaque;
}
+
+ void UpdateBlendColor()
+ {
+ Control.Color = Specific.GetBlendColor(Element).ToNative();
+ }
+
+ void UpdateAll()
+ {
+ UpdateSource();
+ UpdateAspect();
+ UpdateIsOpaque();
+ UpdateBlendColor();
+ }
}
public interface IImageSourceHandler : IRegisterable