summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs b/Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs
new file mode 100644
index 00000000..6991b322
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/LayoutExtensions.cs
@@ -0,0 +1,33 @@
+´╗┐using System.Collections.Generic;
+using Windows.UI.Xaml;
+using WSize = Windows.Foundation.Size;
+
+#if WINDOWS_UWP
+
+namespace Xamarin.Forms.Platform.UWP
+#else
+
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ public delegate SizeRequest? GetDesiredSizeDelegate(NativeViewWrapperRenderer renderer, double widthConstraint, double heightConstraint);
+
+ public delegate WSize? ArrangeOverrideDelegate(NativeViewWrapperRenderer renderer, WSize finalSize);
+
+ public delegate WSize? MeasureOverrideDelegate(NativeViewWrapperRenderer renderer, WSize availableSize);
+
+ public static class LayoutExtensions
+ {
+ public static void Add(this IList<View> children, FrameworkElement view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, ArrangeOverrideDelegate arrangeOverrideDelegate = null,
+ MeasureOverrideDelegate measureOverrideDelegate = null)
+ {
+ children.Add(view.ToView(getDesiredSizeDelegate, arrangeOverrideDelegate, measureOverrideDelegate));
+ }
+
+ public static View ToView(this FrameworkElement view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, ArrangeOverrideDelegate arrangeOverrideDelegate = null,
+ MeasureOverrideDelegate measureOverrideDelegate = null)
+ {
+ return new NativeViewWrapper(view, getDesiredSizeDelegate, arrangeOverrideDelegate, measureOverrideDelegate);
+ }
+ }
+} \ No newline at end of file