Beispiel #1
0
 public TextBlock_Configurer(Label label, TextblockLayout layout)
 {
     this.Label                   = label;
     this.Layout                  = layout;
     this.assignedTextColor       = label.TextColor;
     this.assignedBackgroundColor = label.BackgroundColor;
 }
        public LayoutChoice_Set Get(double fontsize, int numComponents)
        {
            TextblockLayout result;

            if (numComponents > 1)
            {
                result = new TextblockLayout("    " + this.text, fontsize);
            }
            else
            {
                result = new TextblockLayout(this.text, fontsize);
            }
            result.AlignVertically(Xamarin.Forms.TextAlignment.Center);
            return(result);
        }
Beispiel #3
0
        private LayoutChoice_Set MakeSublayout(AppContribution contribution)
        {
            // get some properties
            AppContributor who         = contribution.Contributor;
            string         name        = who.Name;
            string         when        = contribution.DateTime.ToString("yyyy-MM-dd");
            string         description = contribution.Description;
            double         fontSize    = 16;
            double         nameSize    = 30;

            // build the name button layout
            LayoutChoice_Set nameLayout;

            if (who.Email != null || who.Website != null)
            {
                // If this contributor provided details, then make a button to show those details
                Vertical_GridLayout_Builder detailBuilder = new Vertical_GridLayout_Builder();
                detailBuilder.AddLayout(new TextblockLayout("Contributor Name: " + name, fontSize));
                if (who.Email != null)
                {
                    detailBuilder.AddLayout(new TextblockLayout("Email: " + who.Email, fontSize));
                }
                if (who.Website != null)
                {
                    detailBuilder.AddLayout(new TextblockLayout("Website: " + who.Website, fontSize));
                }
                nameLayout = new HelpButtonLayout(name, detailBuilder.Build(), layoutStack, nameSize);
            }
            else
            {
                // If this contributor didn't provide details, then just display their name
                TextblockLayout l = new TextblockLayout(name, nameSize);
                l.AlignHorizontally(TextAlignment.Center);
                nameLayout = l;
            }

            // build the rest of the layout
            Vertical_GridLayout_Builder fullBuilder = new Vertical_GridLayout_Builder();

            fullBuilder.AddLayout(nameLayout);
            fullBuilder.AddLayout(new TextblockLayout("On " + when + ": " + description, fontSize));
            fullBuilder.AddLayout(new TextblockLayout("Thanks!", fontSize));
            return(fullBuilder.Build());
        }
Beispiel #4
0
        public TextMeasurement_Test_Layout()
        {
            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            Editor textBox = new Editor();

            textBox.TextChanged += TextBox_TextChanged;
            this.textBox         = textBox;
            gridBuilder.AddLayout(new TextboxLayout(textBox, 16));

            for (double i = 0; i < 8; i += 1)
            {
                Label textBlock1 = new Label();
                textBlock1.BackgroundColor = Color.Red;
                TextblockLayout textBlockLayout = new TextblockLayout(textBlock1, i + 16, false, true);
                textBlockLayout.ScoreIfEmpty = false;
                gridBuilder.AddLayout(textBlockLayout);
                this.textBlockLayouts.Add(textBlockLayout);
            }

            this.SubLayout = ScrollLayout.New(gridBuilder.Build());
        }
        private LayoutChoice_Set build()
        {
            GridLayout_Builder mainBuilder = new Vertical_GridLayout_Builder().Uniform();

            this.buttons            = new List <Button>();
            this.subtitles          = new List <TextblockLayout>();
            this.buttonDestinations = new Dictionary <Button, ValueProvider <StackEntry> >();
            for (int i = 0; i < this.buttonNameProviders.Count; i++)
            {
                Button button = new Button();
                button.Clicked += Button_Clicked;
                this.buttons.Add(button);

                ButtonLayout    buttonLayout   = new ButtonLayout(button);
                TextblockLayout subtitleLayout = new TextblockLayout();
                subtitleLayout.AlignHorizontally(TextAlignment.Center);
                subtitleLayout.AlignVertically(TextAlignment.Center);
                subtitleLayout.ScoreIfEmpty = false;
                this.subtitles.Add(subtitleLayout);

                BoundProperty_List columnWidths = new BoundProperty_List(2);
                columnWidths.SetPropertyScale(0, 2);
                columnWidths.SetPropertyScale(1, 1);
                columnWidths.BindIndices(0, 1);
                GridLayout entryGrid = GridLayout.New(new BoundProperty_List(1), columnWidths, LayoutScore.Get_UnCentered_LayoutScore(1));
                entryGrid.AddLayout(buttonLayout);
                entryGrid.AddLayout(subtitleLayout);

                LayoutUnion content = new LayoutUnion(entryGrid, buttonLayout);
                mainBuilder.AddLayout(content);

                ValueProvider <StackEntry> destinationProvider = destinationProviders[i];
                this.buttonDestinations[button] = destinationProvider;
            }
            return(LayoutCache.For(mainBuilder.BuildAnyLayout()));
        }
Beispiel #6
0
 public TextBlock_Configurer(Label Label, TextblockLayout layout)
 {
     this.Label  = Label;
     this.Layout = layout;
 }