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

Same BoxView style multiple uses

$
0
0

I've created a simple BoxView which is really just a line across the width of the device in order to indicate different sections of my app:

BoxView partition = new BoxView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest = 2,
                Color = Color.Black
            };

I can't seem to be able to show this multiple times in my carousel, content page, for example:

new ContentPage
{
    Content = new StackLayout
    {
        Children =
        {
            myButton,
            partition,      // this shows up fine
            myImage,
            partition       // this second call to partition isn't shown
        }
    }
}

It strikes me as odd that I can't use the same view multiple times, is there a different way I should be calling it? Or will I have to declare another BoxView with the same variables - this seems a bit of a waste, not to mention an annoyance if I want to change them all later on. (Which of course for something so small is not as much of a problem, but I'm pretty sure I'll be creating a more complicated custom view in the future).


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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