From 31ba696514f9b069d5dd6a8520d4f9f2ef963f74 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 28 May 2016 03:32:11 +1000 Subject: WinRT/UWP center crop image on AspectFill (#190) --- Xamarin.Forms.Platform.WinRT/ImageRenderer.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs b/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs index 3807570d..370da329 100644 --- a/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs @@ -97,6 +97,16 @@ namespace Xamarin.Forms.Platform.WinRT void UpdateAspect() { Control.Stretch = GetStretch(Element.Aspect); + if (Element.Aspect == Aspect.AspectFill) // Then Center Crop + { + Control.HorizontalAlignment = HorizontalAlignment.Center; + Control.VerticalAlignment = VerticalAlignment.Center; + } + else // Default + { + Control.HorizontalAlignment = HorizontalAlignment.Left; + Control.VerticalAlignment = VerticalAlignment.Top; + } } async void UpdateSource() -- cgit v1.2.3