how to create a straight line between 2 StackLayouts? just to Separate

EBatikEBatik NLMember ✭✭✭

So i am looking for a separator ! in order to separate 2 views . for example 2 layouts. Any ideas? (.cs)

Tagged:

Best Answers

  • seanydaseanyda GB ✭✭✭✭✭
    Accepted Answer

    Box view with 1px height? Put them 2 stack layouts in a stack layout in between the box view :P

  • JohnHardmanJohnHardman GB mod
    Accepted Answer

    @EBatik - you can use either a BoxView or a ContentView. Whichever you choose, just make it one pixel high and set a suitable color.

    Alternatively, you may be able to use Padding or Margin on one of the views that you already have on your page.

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭
    Accepted Answer

    Box view with 1px height? Put them 2 stack layouts in a stack layout in between the box view :P

  • JohnHardmanJohnHardman GBUniversity mod
    Accepted Answer

    @EBatik - you can use either a BoxView or a ContentView. Whichever you choose, just make it one pixel high and set a suitable color.

    Alternatively, you may be able to use Padding or Margin on one of the views that you already have on your page.

  • ChaseFlorellChaseFlorell CAInsider, University mod

    Two StackLayouts does not a Grid make :)

  • XavierPerseguersXavierPerseguers CHMember ✭✭✭

    Just wanted to add something here since the accepted answer does not actually always return a 1px line. In my case, on an iPhone X, I always got a 2 px line although asking for 1. The cause is the screen density.

    This post (iOS + Android) allowed me to really get 1px: https://stackoverflow.com/questions/43693026/xamarin-forms-always-get-1px

Sign In or Register to comment.