--- /dev/null
+namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
+{
+ using FormsElement = Forms.Image;
+
+ public static class Image
+ {
+ public static readonly BindableProperty BlendColorProperty = BindableProperty.Create("BlendColor", typeof(Color), typeof(FormsElement), Color.Default);
+
+ public static Color GetBlendColor(BindableObject element)
+ {
+ return (Color)element.GetValue(BlendColorProperty);
+ }
+
+ public static void SetBlendColor(BindableObject element, Color color)
+ {
+ element.SetValue(BlendColorProperty, color);
+ }
+
+ public static Color GetBlendColor(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetBlendColor(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetBlendColor(this IPlatformElementConfiguration<Tizen, FormsElement> config, Color color)
+ {
+ SetBlendColor(config.Element, color);
+ return config;
+ }
+ }
+}
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Compile Include="PlatformConfiguration\iOSSpecific\UIStatusBarAnimation.cs" />
<Compile Include="PlatformConfiguration\iOSSpecific\UpdateMode.cs" />
<Compile Include="PlatformConfiguration\iOSSpecific\VisualElement.cs" />
+ <Compile Include="PlatformConfiguration\TizenSpecific\Image.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\ProgressBar.cs" />
<Compile Include="PlatformConfiguration\WindowsSpecific\MasterDetailPage.cs" />
<Compile Include="PlatformConfiguration\WindowsSpecific\CollapseStyle.cs" />
+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)
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;
{
Control.IsOpaque = Element.IsOpaque;
}
+
+ void UpdateBlendColor()
+ {
+ Control.Color = Specific.GetBlendColor(Element).ToNative();
+ }
+
+ void UpdateAll()
+ {
+ UpdateSource();
+ UpdateAspect();
+ UpdateIsOpaque();
+ UpdateBlendColor();
+ }
}
public interface IImageSourceHandler : IRegisterable