summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
authorAdam <adamped@users.noreply.github.com>2016-05-27 17:32:11 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-05-27 17:32:11 (GMT)
commit31ba696514f9b069d5dd6a8520d4f9f2ef963f74 (patch)
tree0c3cff8923b5c4cd2ecc1f11b2584df57f8a1806 /Xamarin.Forms.Platform.WinRT
parentd1ab4e1ce8b77a6df1d9981db69eff156ee945a6 (diff)
downloadxamarin-forms-31ba696514f9b069d5dd6a8520d4f9f2ef963f74.zip
xamarin-forms-31ba696514f9b069d5dd6a8520d4f9f2ef963f74.tar.gz
xamarin-forms-31ba696514f9b069d5dd6a8520d4f9f2ef963f74.tar.bz2
WinRT/UWP center crop image on AspectFill (#190)
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/ImageRenderer.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs b/Xamarin.Forms.Platform.WinRT/ImageRenderer.cs
index 3807570..370da32 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()