0
votes

Good morning

I am struggling with detection if label`s text is higher than container. I tried to find some already done solution but couldn't find anything. Before I would start to implement some runtime solution in code behind I decided to ask you if I missed some knowledge.

I have and CarouselView which custom DataTemplate as below:

                      <Frame BorderColor="DarkGray"
                       CornerRadius="9"
                       HorizontalOptions="Center"
                       VerticalOptions="CenterAndExpand">
                            <StackLayout>
                                <Label Text="{Binding Feed.Title}" 
                                       TextColor="Black" 
                                       FontSize="Title" 
                                       HorizontalTextAlignment="Center"/>
                                <Image MinimumHeightRequest="200"
                                       MinimumWidthRequest="200">
                                    <Image.Source>
                                        <UriImageSource CachingEnabled="true"
                                                        Uri="{Binding Feed.ImageSource.AbsoluteUri}"
                                                        CacheValidity="1"/>
                                    </Image.Source>
                                </Image>
                                <Label 
                                                        Text="{Binding Feed.Description}" 
                                                        TextColor="Gray"
                                                        FontSize="Subtitle"/>
                            </StackLayout>
                        </Frame>
                    </DataTemplate>

When second label`s text is big it get sank in parent view as on picture:

enter image description here

As the solution I would like to remove not cut / not visible text and add three dots. Is there any done solution or I should try to do runtime height measurements?

Thanks!

have you read the docs on truncation and wrapping? docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/… - Jason