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

how to align Label control horizontally in listview

$
0
0

hello,
I'm new to xamarin forms (I used to develop on wp/xaml)
I have a chat in my app, and I would like to display the message left or right according to the sender (ex: me on the left the other one on the right, like sms)

<ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell >
            <ViewCell.View >
             <StackLayout HorizontalOptions="Center" BackgroundColor="White" Orientation="Horizontal" WidthRequest="270">
                <Label WidthRequest="230" HorizontalOptions="End" IsVisible="{Binding isText}"  Grid.Row="1"  TextColor="Black" Text="{Binding msg}" Font="15,Bold" />
              </StackLayout>
            </ViewCell.View>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>

I think the StackLayout is not the one I should use.
any idea of which container to use to align the label horizontally right or left?thanks in advance!

Viewing all articles
Browse latest Browse all 81910

Trending Articles



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