Пример #1
0
        public BackgroundImagePage()
        {
            var imgName = Device.RuntimePlatform == "iOS" ? "Default.png" : "screen.png";

            this.BackgroundImage = imgName;

            var formattedString = new FormattedString();

            formattedString.AddTextSpan("\tSimply setting the background image in iOS may result in the image tiling across the screen. Some articles suggest using an absolute layout with a bottom layer being an image. In the readme.txt find a url to create icons and splash screen assets and place them in your project. \n\n");
            formattedString.AddTextSpan("\tSet the page's BackgroundImage property and the BasePageRenderer in the CommonCore will fix the tiling issue without you having to layer controls to accomplish the effect.");
            var lbl = new Label()
            {
                FormattedText = formattedString
            };

            var frame = new Frame()
            {
                Margin          = 10,
                Padding         = 10,
                BackgroundColor = Color.White,
                Opacity         = 0.5,
                Content         = new StackLayout()
                {
                    Children = { lbl }
                }
            };


            Content = new StackContainer(true)
            {
                Children = { frame }
            };
        }
Пример #2
0
        public LandingPage()
        {
            Title           = "Landing";
            BackgroundColor = Color.White;

            var topImage = new CachedImage()
            {
                Source            = "sharedcode.png",
                Aspect            = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            var customFont = new Label()
            {
                Style = CoreStyles.FontLabel,
                Text  = "Xamarin.Forms.CommonCore"
            };

            var fs = new FormattedString();

            //using an extension method to add span with text
            fs.AddTextSpan("  Xamarin.Forms provides a platform to resuse code across logic and UI development. " +
                           "There is tremendous debate on the use of portable class libraries versus shared projects. \n\n");

            fs.AddTextSpan("  After using the CommonCore project, the benefits of shared projects should be apparent with nested files, compiler directives and ease of change." +
                           " It is still possible to write spaghetti code which XAML does help prevent but good team standards can mitigate these issues.\n\n");

            fs.AddTextSpan("  CommonCore uses Unity to create static instances of the application's view models and service classes through dependency injection." +
                           " Take a moment to view the readme file in order to understand all the nuget files and configuration settings available through CommonCore.");


            var lbl = new Label()
            {
                FormattedText = fs, Margin = 10
            };

            Content = new Xamarin.Forms.ScrollView()
            {
                Content = new CompressedStackLayout()
                {
                    Children =
                    {
                        topImage,
                        customFont,
                        lbl
                    }
                }
            };
        }
Пример #3
0
        public AboutPage()
        {
            this.Title = "About";

            var img = new CachedImage()
            {
                Source = "paperStackImage.png",
                Margin = 5
            };
            var txtTitle = new Label()
            {
                Text      = "Todo Manager.",
                FontSize  = 32,
                Margin    = 5,
                TextColor = Color.DarkGray
            };

            var topPanel = new StackLayout()
            {
                Margin      = new Thickness(20, 25, 20, 25),
                Orientation = StackOrientation.Horizontal,
                Children    = { img, txtTitle }
            };

            var aboutText = new FormattedString();

            aboutText.AddTextSpan("Version 1.0.0 \r");
            aboutText.AddTextSpan("Xamarin Meetup Demo \r");
            aboutText.AddTextSpan("by \r");
            aboutText.AddTextSpan("Les Brown \r");

            Content = new StackLayout()
            {
                Children =
                {
                    topPanel,
                    new Label()
                    {
                        TextColor               = Color.DarkGray,
                        Margin                  = new Thickness(20),
                        FormattedText           = aboutText,
                        FontSize                = 32,
                        HorizontalTextAlignment = TextAlignment.Center
                    }
                }
            };
        }