Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Xamarin forms Listview selected item background color

$
0
0

just don't know how to fix it in cross platofrom renderer way, I've tried to over paint it from code, but no results, there is that blue line between list items and I don't know how to fix, if anybody have a working example of a view cell renderers both on ios and android, is it possible at all?

    namespace FormsApp
    {
        [Preserve]
        public class MenuButtonView : ViewCell
        {
            public MenuButtonView()
            {
                var imageView = new Image();
                imageView.SetBinding(Image.SourceProperty, new Binding("ImageUri"));
                var label = new ExtendedLabel
                {
                    FontName = "OpenSansLight.ttf",
                    FontSize = 16
                };
                label.SetBinding(ExtendedLabel.TextProperty, new Binding("Name"));
                label.SetBinding(ExtendedLabel.TextColorProperty, new Binding("TextColor"));


                RelativeLayout layout = new RelativeLayout { HeightRequest = 38 };
                layout.SetBinding(Layout.BackgroundColorProperty, new Binding("BackgroundColor"));

                BoxView background = new BoxView { HeightRequest = 50, WidthRequest = 300, Color = Color.White };
                    //          background.SetBinding(BoxView.ColorProperty, new Binding("BackgroundColor"));

                layout.Children.Add(imageView,
                    Constraint.Constant(14),
                    Constraint.Constant(14),
                    Constraint.Constant(24),
                    Constraint.Constant(24)
                );

                layout.Children.Add(background,
                    Constraint.Constant(0),
                    Constraint.Constant(0),
                    Constraint.RelativeToParent( (parent) => { return parent.Width; }),
                    Constraint.Constant(40)
                );

                layout.Children.Add(label,
                    Constraint.Constant(65),
                    Constraint.Constant(15),
                    Constraint.RelativeToParent( (parent) => { return parent.Width; }),
                    Constraint.Constant(38)
                );

                View = layout;
            }
        }
    }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>