Esempio n. 1
0
 protected virtual View CreateFooterView()
 {
     if (Element is StructuredItemsView structuredItemsView)
     {
         if (structuredItemsView.Footer != null)
         {
             View footer = null;
             if (structuredItemsView.Footer is View view)
             {
                 footer = view;
             }
             else if (structuredItemsView.FooterTemplate != null)
             {
                 footer = structuredItemsView.FooterTemplate.CreateContent() as View;
                 footer.BindingContext = structuredItemsView.Footer;
             }
             else if (structuredItemsView.Footer is String str)
             {
                 footer = new XLabel {
                     Text = str,
                 };
             }
             return(footer);
         }
     }
     return(null);
 }
Esempio n. 2
0
        public ItemDefaultTemplateAdaptor(ItemsView itemsView) : base(itemsView)
        {
            ItemTemplate = new DataTemplate(() =>
            {
                var label = new XLabel
                {
                    TextColor = XColor.FromRgb(0, 0, 0),
                };
                label.SetBinding(XLabel.TextProperty, new Binding(".", converter: new ToTextConverter()));

                return(new XStackLayout
                {
                    BackgroundColor = XColor.FromRgb(255, 255, 255),
                    Padding = 30,
                    Children =
                    {
                        label
                    }
                });
            });
        }
Esempio n. 3
0
        protected override void Init()
        {
            var span = new Span
            {
                Text =
                    " Mi augue molestie ligula lobortis enim Velit, in. \n Imperdiet eu dignissim odio. Massa erat Hac inceptos facilisis nibh " +
                    " Interdum massa Consectetuer risus sociis molestie facilisi enim. Class gravida. \n Gravida sociosqu cras Quam velit, suspendisse" +
                    "  leo auctor odio integer primis dui potenti dolor faucibus augue justo morbi ornare sem. "
            };

            var formattedString = new FormattedString();

            formattedString.Spans.Add(span);

            var label = new Microsoft.Maui.Controls.Label
            {
                LineBreakMode   = LineBreakMode.TailTruncation,
                VerticalOptions = LayoutOptions.Start,
                FormattedText   = formattedString,
                MaxLines        = 3
                                  //max line is less than the text reproduce and textViewExtensions couldn't identify when
                                  //it's already pass the MaxLines range because of the paragraph('\n' character).
            };

            var labelDescription = new Label
            {
                Text            = "If you opened this page, the app didn't crash and you can read three lines in the label above, this test has passed",
                VerticalOptions = LayoutOptions.StartAndExpand
            };

            var layout = new Microsoft.Maui.Controls.StackLayout();

            layout.Children.Add(label);
            layout.Children.Add(labelDescription);

            Content = layout;
        }