Пример #1
0
        public SampleListCell()
        {
            this.SetBinding(TypeProperty, "SampleType");

            var sampleName = new LabelExt {
                VerticalOptions = LayoutOptions.Center
            };

            sampleName.SetBinding(Label.TextProperty, "Title");
            sampleName.VerticalOptions = LayoutOptions.Center;
            //if (Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone)
            //    sampleName.HorizontalOptions = LayoutOptions.FillAndExpand;

            sampleName.FontSize = Device.Idiom == TargetIdiom.Tablet
                ? Device.OnPlatform(15, 15, 25)
                : Device.OnPlatform(13, 13, 25);

            sampleName.VerticalOptions = LayoutOptions.Center;
            if ((Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone) || Device.OS == TargetPlatform.WinPhone)
            {
                sampleName.TextColor = Color.White;
                sampleName.FontSize  = 23;
            }
            else
            {
                sampleName.TextColor = Color.Black;
            }

            rootLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };
            if (Device.Idiom != TargetIdiom.Phone && Device.OS == TargetPlatform.Windows)
            {
                sampleName.SetBinding(Label.TextColorProperty, new Binding("ForegroundColor"));
                rootLayout.SetBinding(Layout.BackgroundColorProperty, new Binding("BackgroundColor"));
            }

            rootLayout.Children.Add(sampleName);
            rootLayout.Padding           = new Thickness(12, 10, 5, 5);
            rootLayout.VerticalOptions   = LayoutOptions.Center;
            rootLayout.HorizontalOptions = LayoutOptions.Center;

            View = rootLayout;
        }
Пример #2
0
        public ControlListCellMobile()
        {
            controlIcon = new Image
            {
                VerticalOptions = LayoutOptions.Center,
                HeightRequest   = Device.OnPlatform(40, 40, 70),
                WidthRequest    = Device.OnPlatform(40, 40, 70),
                Aspect          = Aspect.AspectFill
            };

            this.SetBinding(ImageIDProperty, "ImageID");
            this.SetBinding(TypeProperty, "Type");

            var controlName = new LabelExt
            {
                VerticalOptions = LayoutOptions.Center,
            };

            if (Device.Idiom == TargetIdiom.Phone && Device.OS == TargetPlatform.Windows)
            {
                //     controlName.HorizontalOptions = LayoutOptions.FillAndExpand;
                controlName.FontSize = 27;
            }
            else
            {
                controlName.FontSize = Device.OnPlatform(18, 18, 27);
            }

            controlName.SetBinding(Label.TextProperty, "Title");

            rootLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };
            rootLayout.Children.Add(controlIcon);
            rootLayout.Children.Add(controlName);

            rootLayout.Spacing = 10;

            rootLayout.Padding = Device.OnPlatform(new Thickness(15, 5, 5, 5), new Thickness(5, 5, 5, 5),
                                                   new Thickness(15, 3, 5, 15));

            rootLayout.VerticalOptions = LayoutOptions.Center;
            View = rootLayout;
        }
        public SampleListCell()
        {
            this.SetBinding(TypeProperty, "SampleType");

            var sampleName = new LabelExt {
                VerticalOptions = LayoutOptions.Center
            };

            sampleName.SetBinding(Label.TextProperty, "Title");
            sampleName.VerticalOptions = LayoutOptions.Center;
            //if (Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone)
            //    sampleName.HorizontalOptions = LayoutOptions.FillAndExpand;

            if (Device.Idiom == TargetIdiom.Desktop || Device.Idiom == TargetIdiom.Tablet)
            {
                sampleName.WidthRequest = 210;
            }
            sampleName.FontSize = Device.Idiom == TargetIdiom.Tablet
                ? DeviceExt.OnPlatform(15, 15, 25)
                : DeviceExt.OnPlatform(13, 13, 25);

            sampleName.VerticalOptions = LayoutOptions.Center;
            if ((Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone) || Device.OS == TargetPlatform.WinPhone)
            {
                sampleName.TextColor = Color.White;
                sampleName.FontSize  = 23;
            }
            else
            {
                sampleName.TextColor = Color.Black;
            }

            if (App.Platform == Platforms.UWP && Device.Idiom == TargetIdiom.Phone)
            {
                sampleName.FontSize = 15;
            }

            rootLayout = new Grid
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(60, GridUnitType.Absolute)
                    }
                }
            };

            if (Device.OS != TargetPlatform.Android)
            {
                rootLayout.BackgroundColor = Color.White;
            }
            sampleName.TextColor = Color.FromHex("#333D47");
            if (Device.Idiom != TargetIdiom.Phone && Device.OS == TargetPlatform.Windows)
            {
                sampleName.FontSize = 15;
                sampleName.SetBinding(Label.TextColorProperty, new Binding("ForegroundColor"));
                rootLayout.SetBinding(Layout.BackgroundColorProperty, new Binding("BackgroundColor"));
            }

            rootLayout.VerticalOptions = LayoutOptions.Center;

            if (Device.OS == TargetPlatform.Android)
            {
                rootLayout.HorizontalOptions = LayoutOptions.StartAndExpand;
            }
            else
            {
                rootLayout.HorizontalOptions = LayoutOptions.Center;
            }

            rootLayout.Children.Add(sampleName, 0, 0);

            rootLayout.Padding = DeviceExt.OnPlatform(new Thickness(15, 10, 5, 5), new Thickness(15, 10, 5, 5),
                                                      new Thickness(4, 3, 5, 3));

            if (Ext.IsWinPhone())
            {
                StackLayout stackLayout = new StackLayout
                {
                    Children        = { rootLayout },
                    BackgroundColor = Color.White,
                    Padding         = 0,
                    Spacing         = 0,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                };

                View = stackLayout;
            }
            else
            {
                View = rootLayout;
            }
        }
        public ControlListCellMobile()
        {
            controlIcon = new Image
            {
                VerticalOptions = LayoutOptions.Center,
                HeightRequest = Device.OnPlatform(40, 40, 70),
                WidthRequest = Device.OnPlatform(40, 40, 70),
                Aspect = Aspect.AspectFill
            };

            this.SetBinding(ImageIDProperty, "ImageID");
            this.SetBinding(TypeProperty, "Type");

            var controlName = new LabelExt
            {
                VerticalOptions = LayoutOptions.Center,
            };

            if (Device.Idiom == TargetIdiom.Phone && Device.OS == TargetPlatform.Windows)
            {
           //     controlName.HorizontalOptions = LayoutOptions.FillAndExpand; 
                controlName.FontSize = 27;
            }
            else
                controlName.FontSize = Device.OnPlatform(18, 18, 27);

            controlName.SetBinding(Label.TextProperty, "Title");
           
            rootLayout = new StackLayout {Orientation = StackOrientation.Horizontal};
            rootLayout.Children.Add(controlIcon);
            rootLayout.Children.Add(controlName);

            rootLayout.Spacing = 10;

            rootLayout.Padding = Device.OnPlatform(new Thickness(15, 5, 5, 5), new Thickness(5, 5, 5, 5),
                new Thickness(15, 3, 5, 15));

            rootLayout.VerticalOptions = LayoutOptions.Center;
            View = rootLayout;
        }
        public SampleListCell()
        {
			this.SetBinding (TypeProperty, "SampleType");

            var sampleName = new LabelExt { VerticalOptions = LayoutOptions.Center };
            sampleName.SetBinding(Label.TextProperty, "Title");
            sampleName.VerticalOptions = LayoutOptions.Center;
            //if (Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone)
            //    sampleName.HorizontalOptions = LayoutOptions.FillAndExpand;

            sampleName.FontSize = Device.Idiom == TargetIdiom.Tablet
                ? Device.OnPlatform(15, 15, 25)
                : Device.OnPlatform(13, 13, 25);

			sampleName.VerticalOptions = LayoutOptions.Center;
            if ((Device.OS == TargetPlatform.Windows && Device.Idiom == TargetIdiom.Phone) || Device.OS == TargetPlatform.WinPhone)
            {
                sampleName.TextColor = Color.White;
                sampleName.FontSize = 23;
            }
            else
                sampleName.TextColor = Color.Black;

			rootLayout = new StackLayout {Orientation = StackOrientation.Horizontal};
            if (Device.Idiom != TargetIdiom.Phone && Device.OS == TargetPlatform.Windows)
            {
                sampleName.SetBinding(Label.TextColorProperty, new Binding("ForegroundColor"));
                rootLayout.SetBinding(Layout.BackgroundColorProperty, new Binding("BackgroundColor"));
            }

            rootLayout.Children.Add(sampleName);
            rootLayout.Padding = new Thickness(12, 10, 5, 5);
			rootLayout.VerticalOptions = LayoutOptions.Center;
			rootLayout.HorizontalOptions = LayoutOptions.Center;

			View = rootLayout;
        }