diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Extensions/LayoutExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Extensions/LayoutExtensions.cs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Extensions/LayoutExtensions.cs b/Xamarin.Forms.Platform.Tizen/Extensions/LayoutExtensions.cs new file mode 100644 index 00000000..4880beb8 --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Extensions/LayoutExtensions.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using ElmSharp; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// <summary> + /// Extension class, provides native embedding functionalities: + /// https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/add-platform-controls/ + /// </summary> + /// <remarks> + /// This code is not used in the Xamarin.Forms.Platform.Tizen implementation, however it should not + /// be removed as it allows developers to use native controls directly. + /// </remarks> + public static class LayoutExtensions + { + /// <summary> + /// Add the specified evas object to the list of children views. + /// </summary> + /// <param name="children">The extended class.</param> + /// <param name="obj">Object to be added.</param> + /// <param name="measureDelegate">Optional delegate which provides measurements for the added object.</param> + public static void Add(this IList<View> children, EvasObject obj, MeasureDelegate measureDelegate = null) + { + children.Add(obj.ToView(measureDelegate)); + } + + /// <summary> + /// Wraps the evas object into a view which can be used by Xamarin. + /// </summary> + /// <returns>The Xamarin view which wraps the evas object.</returns> + /// <param name="obj">The extended class.</param> + /// <param name="measureDelegate">Optional delegate which provides measurements for the evas object.</param> + public static View ToView(this EvasObject obj, MeasureDelegate measureDelegate = null) + { + return new EvasObjectWrapper(obj, measureDelegate); + } + } +} |