summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/LayoutExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/LayoutExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.WP8/LayoutExtensions.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WP8/LayoutExtensions.cs b/Xamarin.Forms.Platform.WP8/LayoutExtensions.cs
new file mode 100644
index 00000000..1fb1f247
--- /dev/null
+++ b/Xamarin.Forms.Platform.WP8/LayoutExtensions.cs
@@ -0,0 +1,27 @@
+´╗┐using System.Collections.Generic;
+using System.Windows;
+using WSize = System.Windows.Size;
+
+namespace Xamarin.Forms.Platform.WinPhone
+{
+ 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