コード例 #1
0
        /// <summary>
        /// Sets the current orientation of the given <see cref="StackPanel"/> layout control by the given orientation value.
        /// </summary>
        /// <param name="layout">
        /// The <see cref="StackPanel"/> to update the orientation.
        /// </param>
        /// <param name="orientation">
        /// The orientation to update with.
        /// </param>
        public static void SetOrientation(this StackPanel layout, Orientation orientation)
        {
            if (layout == null)
            {
                return;
            }

            layout.Orientation = orientation == Orientation.Vertical ? Windows.UI.Xaml.Controls.Orientation.Vertical : Windows.UI.Xaml.Controls.Orientation.Horizontal;
        }
コード例 #2
0
        /// <summary>
        /// Sets the orientation property of the given LinearLayout by the given Orientation option.
        /// </summary>
        /// <param name="layout">
        /// The linear layout to update orientation.
        /// </param>
        /// <param name="orientation">
        /// The orientation to update with.
        /// </param>
        public static void SetOrientation(
            this Android.Widget.LinearLayout layout,
            XPlat.UI.Controls.Orientation orientation)
        {
            if (layout == null)
            {
                return;
            }

            layout.Orientation = orientation == XPlat.UI.Controls.Orientation.Vertical
                                     ? Android.Widget.Orientation.Vertical
                                     : Android.Widget.Orientation.Horizontal;

            layout.Invalidate();
        }