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

How to right-align a view inside a list item?

$
0
0

Hi,

I have a ListView with an ItemTemplate that contains a horizontal StackLayout that has a label and a Button. I want the label aligned to the left of the screen (works by default) and the button aligned to the right side of the screen (right-justified, does not work). Instead the button is placed just to the right of the label.

I tried to use LayoutOptions.End for the button like this:

`selectButton.HorizontalOptions = LayoutOptions.End;

                return new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =  { titleLabel, selectButton }
                    }
                };

`

but it had no effect. The button is still just to the right of the label. Can I right-align a view in a list item or do I need to switch from ListView to a TableView?

Thanks!


Viewing all articles
Browse latest Browse all 75885

Trending Articles



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