Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin Portable Comments Stacklayout height problems Listview

$
0
0

I am having trouble with height problems in Xamarin PCL with Listview. I want to create a comments section in a scrollable page. But i am struggling with the height of the comments. It just wont expand.

Row.Definition = Auto for the Grid:

            <StackLayout Grid.Row="4" Padding="0,20,0,0">
                <ListView ItemsSource="{Binding CommentsMVVM}" HasUnevenRows="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <local:CommentsRow />
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>

In the CommentsRow template:

<Grid RowSpacing="0" ColumnSpacing="14" Padding="20" VerticalOptions="FillAndExpand">

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <Image Grid.Column="0" Grid.RowSpan="3" Source="{ Binding Image }" VerticalOptions="Start" />

    <Label Grid.Column="1" Grid.Row="0" Text="{ Binding UserName }" VerticalOptions="EndAndExpand" TextColor="Blue" />

    <Label Grid.Column="1" Grid.Row="1" Margin="0,4,0,0" Text="{ Binding CreatedAt }" TextColor="Grey" FontSize="13" />

    <StackLayout Grid.Column="1" Grid.Row="2" Spacing="30" x:Name="StackLayoutMap"  VerticalOptions="FillAndExpand" />



</Grid>

And at the C#:

    public CommentsRow()
    {

        InitializeComponent();

        var html_label = new HtmlFormattedLabel()
        {
            TextColor = Color.Black,
            FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
        };


        html_label.SetBinding(HtmlFormattedLabel.TextProperty, "Memo");

        this.StackLayoutMap.Children.Add(html_label);



    }

But the StackLayout comments text just wont expand automatically. What am i doing wrong?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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