Issue
I have a large text, I want to display it. I am using a label for this. But this label does not show full text. I want a vertical scroll for this label.
Grid mainGrid = new Grid
{
HeightRequest = 40,
BackgroundColor = Color.White,
Padding = 20,
RowDefinitions =
{
new RowDefinition { Height = new GridLength(25, GridUnitType.Star) },//0 Title
new RowDefinition { Height = new GridLength(5, GridUnitType.Star) },//1 Line
new RowDefinition { Height = new GridLength(50, GridUnitType.Star) },//2 This is for MessageLabel
new RowDefinition { Height = new GridLength(20, GridUnitType.Star) },//3 OK-Cancel
}
};
MessageLabel = new Label
{
FontAttributes = FontAttributes.None,
FontSize = 18,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.StartAndExpand,
TextColor = Color.Black,
};
mainGrid.Children.Add(MessageLabel, 0, 2);
I have tried different VerticalOptions
for this label, But nothing is working.
If this is not supported for a label. Can I use some other control?
Solution
If you want vertical scroll, you must use a ScrollView, wrap your label / grid within a scrollview, then you can display all the text.
<ScrollView>
<Grid/>
</ScrollView/>
Answered By - Bruno Caceiro
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.