Exemplo n.º 1
0
        public void Init()
        {
            ViewHelper.DefaultViewProperties(this);

            this.Orientation = Me.Orientation;

            Device.OnPlatform(
                Android: () =>
            {
                this.Spacing = OnPlatformDouble.GetAndroidValue(Me.Spacing);
            },
                iOS: () =>
            {
                this.Spacing = OnPlatformDouble.GetiOSValue(Me.Spacing);
            },
                WinPhone: () =>
            {
                this.Spacing = OnPlatformDouble.GetWinPhoneValue(Me.Spacing);
            }
                );

            if (Me.Controls.Count > 0)
            {
                foreach (BaseControl control in Me.Controls)
                {
                    ProcessControl(control);
                }
            }
        }
Exemplo n.º 2
0
        internal static void DefaultViewProperties(IView view)
        {
            View formView = view.GetView();

            BaseControl me = view.BaseControl;


            Device.OnPlatform(
                Android: () =>
            {
                if (OnPlatformDouble.GetAndroidValue(me.HeightRequest) != 0)
                {
                    formView.HeightRequest = OnPlatformDouble.GetAndroidValue(me.HeightRequest);
                }

                if (OnPlatformDouble.GetAndroidValue(me.WidthRequest) != 0)
                {
                    formView.WidthRequest = OnPlatformDouble.GetAndroidValue(me.WidthRequest);
                }


                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(me.BackgroundColor)))
                {
                    formView.BackgroundColor = Color.FromHex(OnPlatformString.GetAndroidValue(me.BackgroundColor));
                }

                if (OnPlatformLayoutOptions.GetAndroidValue(me.HorizontalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions);
                }

                if (OnPlatformLayoutOptions.GetAndroidValue(me.VerticalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions);
                }
            },
                iOS: () =>
            {
                if (OnPlatformDouble.GetiOSValue(me.HeightRequest) != 0)
                {
                    formView.HeightRequest = OnPlatformDouble.GetiOSValue(me.HeightRequest);
                }

                if (OnPlatformDouble.GetiOSValue(me.WidthRequest) != 0)
                {
                    formView.WidthRequest = OnPlatformDouble.GetiOSValue(me.WidthRequest);
                }


                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(me.BackgroundColor)))
                {
                    formView.BackgroundColor = Color.FromHex(OnPlatformString.GetiOSValue(me.BackgroundColor));
                }

                if (OnPlatformLayoutOptions.GetiOSValue(me.HorizontalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions);
                }

                if (OnPlatformLayoutOptions.GetiOSValue(me.VerticalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions);
                }
            },
                WinPhone: () =>
            {
                if (OnPlatformDouble.GetWinPhoneValue(me.HeightRequest) != 0)
                {
                    formView.HeightRequest = OnPlatformDouble.GetWinPhoneValue(me.HeightRequest);
                }

                if (OnPlatformDouble.GetWinPhoneValue(me.WidthRequest) != 0)
                {
                    formView.WidthRequest = OnPlatformDouble.GetWinPhoneValue(me.WidthRequest);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(me.BackgroundColor)))
                {
                    formView.BackgroundColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(me.BackgroundColor));
                }

                if (OnPlatformLayoutOptions.GetWinPhoneValue(me.HorizontalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.HorizontalOptions = GetLayoutOptions(me.HorizontalOptions);
                }

                if (OnPlatformLayoutOptions.GetWinPhoneValue(me.VerticalOptions) != FormLayoutOptions.NotSet)
                {
                    formView.VerticalOptions = GetLayoutOptions(me.VerticalOptions);
                }
            }
                );
        }
Exemplo n.º 3
0
        internal static void DefaultViewProperties(ICell icell)
        {
            Cell     cell = icell.GetCell();
            BaseCell Me   = icell.Cell;

            cell.IsEnabled = Me.Enabled;


            Device.OnPlatform(
                Android: () =>
            {
                if (OnPlatformDouble.GetAndroidValue(Me.Height) != 0)
                {
                    cell.Height = OnPlatformDouble.GetAndroidValue(Me.Height);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.ClassID)))
                {
                    cell.ClassId = OnPlatformString.GetAndroidValue(Me.ClassID);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.StyleID)))
                {
                    cell.StyleId = OnPlatformString.GetAndroidValue(Me.StyleID);
                }
            },
                iOS: () =>
            {
                if (OnPlatformDouble.GetiOSValue(Me.Height) != 0)
                {
                    cell.Height = OnPlatformDouble.GetiOSValue(Me.Height);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.ClassID)))
                {
                    cell.ClassId = OnPlatformString.GetiOSValue(Me.ClassID);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.StyleID)))
                {
                    cell.StyleId = OnPlatformString.GetiOSValue(Me.StyleID);
                }
            },
                WinPhone: () =>
            {
                if (OnPlatformDouble.GetWinPhoneValue(Me.Height) != 0)
                {
                    cell.Height = OnPlatformDouble.GetWinPhoneValue(Me.Height);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.ClassID)))
                {
                    cell.ClassId = OnPlatformString.GetWinPhoneValue(Me.ClassID);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.StyleID)))
                {
                    cell.StyleId = OnPlatformString.GetWinPhoneValue(Me.StyleID);
                }
            }
                );
        }