Beispiel #1
0
        public ControlsPageWindows()
        {
            homePage = new ContentPage();

            BackgroundColor = Color.White;
            controlList     = new ControlListViewModel();

            var mainContent = new StackLayout();

            mainContent.Children.Add(GetHeaderLayout());
            mainContent.Children.Add(GetControlLayout());

            homePage.Content = mainContent;
            Children.Add(homePage);
        }
        public ControlPage()
        {
            rootLayout = new Grid();


            dummyContent = new Label();

            controlList = new ControlListViewModel();

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                Title = DeviceExt.OnPlatform("Essential Studio", "  Essential Studio", "Essential Studio");
                var sampleList = controlList.MasterSampleLists;
                var count      = sampleList.Count;

                rootGrid = new Grid();
                rootLayout.Children.Add(rootGrid);
                rootGrid.Padding = new Thickness(10);

                for (var i = 0; i < count; i++)
                {
                    var control = sampleList[i];

                    StackLayout content;

                    if (Device.OS == TargetPlatform.iOS)
                    {
                        content = new StackLayout {
                            Padding = new Thickness(20, 20, 20, 20), StyleId = i.ToString()
                        };
                    }
                    else
                    {
                        content = new StackLayout {
                            Padding = new Thickness(20, 40, 20, 20), StyleId = i.ToString()
                        };
                    }

                    var tapGestue = new TapGestureRecognizer();
                    content.GestureRecognizers.Add(tapGestue);
                    tapGestue.Tapped += TapGestue_Tapped;

                    var absoluteLayout = new AbsoluteLayout {
                        HeightRequest = 76, WidthRequest = 76
                    };
                    var controlIcon = new Image
                    {
                        HeightRequest = 76,
                        WidthRequest  = 76,
                        Aspect        = Aspect.AspectFit,
                    };
                    if (Device.OS == TargetPlatform.Windows)
                    {
                        controlIcon.Source = ImageSource.FromFile("chart.png");
                    }
                    else
                    {
                        controlIcon.Source = ImageSource.FromResource("SampleBrowser.Icons." + control.ImageID);
                    }
                    var sampleName = new Label
                    {
                        Text              = control.Title,
                        FontSize          = 12,
                        HorizontalOptions = LayoutOptions.Center
                    };

                    content.Children.Add(absoluteLayout);
                    content.Children.Add(sampleName);
                    absoluteLayout.Children.Add(controlIcon);

                    absoluteLayout.HorizontalOptions = LayoutOptions.Center;

                    rootGrid.Children.Add(content);
                }

                if (Device.OS != TargetPlatform.iOS)
                {
                    rootGrid.Children.Add(dummyContent);
                }

                if (Device.OS == TargetPlatform.Android)
                {
                    Content = new ScrollView()
                    {
                        Content = rootLayout
                    }
                }
                ;
                else
                {
                    Content = rootLayout;
                }
            }
            else
            {
                Title = "Essential Studio";

                rootList        = new ListView();
                rootStackLayout = new StackLayout();

                if (!(Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.iOS))
                {
                    Label title = new Label()
                    {
                        Text = " Essential Studio", FontSize = 30, TextColor = Color.Black
                    };
                    rootStackLayout.Children.Add(title);
                    rootStackLayout.Children.Add(rootList);
                    rootLayout.Children.Add(rootStackLayout);
                }
                else
                {
                    rootLayout.Children.Add(rootList);
                }
                rootList.BackgroundColor   = Color.White;
                rootLayout.BackgroundColor = Color.White;
                aboutContent.Text          =
                    "Syncfusion Essential Studio is a collection of user interface and file format manipulation components that can be used to build line-of-business mobile applications.";
                aboutContent.TranslationX = 10;
                aboutContent.FontSize     = 26;

                Title = Device.OS == TargetPlatform.Android ? "  Essential Studio" : "Essential Studio";
                rootList.ItemsSource         = controlList.MasterSampleLists;
                rootList.ItemSelected       += listview_ItemSelected;
                rootList.SeparatorColor      = Color.FromHex("#B2B2B2");
                rootList.SeparatorVisibility = DeviceExt.OnPlatform(SeparatorVisibility.Default, SeparatorVisibility.Default, SeparatorVisibility.None);

                rootList.RowHeight = DeviceExt.OnPlatform(50, 67, 80);

                if (App.Platform == Platforms.UWP && Device.Idiom == TargetIdiom.Phone)
                {
                    rootList.RowHeight = 55;
                }

                rootList.ItemTemplate = new DataTemplate(typeof(ControlListCellMobile));
                Content = rootLayout;
            }
            rootLayout.Children.Add(indicator);
        }
        public ControlPage()
        {
            rootLayout = new Grid();
            
            
            dummyContent = new Label();

            controlList = new ControlListViewModel();

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                
                Title = Device.OnPlatform("Essential Studio", "  Essential Studio", "Essential Studio");
                var sampleList = controlList.MasterSampleLists;
                var count = sampleList.Count;

                rootGrid = new Grid();
                rootLayout.Children.Add(rootGrid);
                rootGrid.Padding = new Thickness(10);

                for (var i = 0; i < count; i++)
                {
                    var control = sampleList[i];

                    var content = new StackLayout {Padding = new Thickness(20, 40, 20, 20), StyleId = i.ToString()};

                    var tapGestue = new TapGestureRecognizer();
                    content.GestureRecognizers.Add(tapGestue);
                    tapGestue.Tapped += TapGestue_Tapped;

                    var absoluteLayout = new AbsoluteLayout {HeightRequest = 76, WidthRequest = 76};
                    var controlIcon = new Image
                    {
                        HeightRequest = 76,
                        WidthRequest = 76,
                        Aspect = Aspect.AspectFit,
                    };
                    if (Device.OS == TargetPlatform.Windows)
                        controlIcon.Source = ImageSource.FromFile("chart.png");
                    else
                        controlIcon.Source = ImageSource.FromResource("SampleBrowser.Icons." + control.ImageID);
                    var sampleName = new Label
                    {
                        Text = control.Title,
                        FontSize = 12,
                        HorizontalOptions = LayoutOptions.Center
                    };

                    content.Children.Add(absoluteLayout);
                    content.Children.Add(sampleName);
                    absoluteLayout.Children.Add(controlIcon);

                    absoluteLayout.HorizontalOptions = LayoutOptions.Center;

                    rootGrid.Children.Add(content);
                }
                rootGrid.Children.Add(dummyContent);
            }
            else
            {
                Title = "Essential Studio";

                rootList = new ListView();
                rootLayout.Children.Add(rootList);
               

                aboutContent.Text =
                    "Syncfusion Essential Studio is a collection of user interface and file format manipulation components that can be used to build line-of-business mobile applications.";
                aboutContent.TranslationX = 10;
                aboutContent.FontSize = 26;

                Title = Device.OS == TargetPlatform.Android ? "  Essential Studio" : "Essential Studio";
                rootList.ItemsSource = controlList.MasterSampleLists;
                rootList.ItemSelected += listview_ItemSelected;

                rootList.RowHeight = Device.OnPlatform(50, 50, 85);
                rootList.ItemTemplate = new DataTemplate(typeof (ControlListCellMobile));
            }
            rootLayout.Children.Add(indicator);
            Content = rootLayout;
        }