Hello,
I am attempting to place a stacklayout into a scrollview. Unfortunately, the scrollview doesn't seem to be able to scroll. This is the case both in the iOS simulator and on the iOS device (iPhone 5S). Is there something I am doing wrong? My code is below. Note that I am using my Markdown parser to convert content from markdown into Labels, Images and (not strictly markdown) Buttons, but this shouldn't affect how the scrollview/stacklayout work together.
private ContentPage BuildContentPage()
{
var contentPage = new ContentPage();
var stackLayout = new StackLayout()
{
};
foreach (var line in _pageLines)
{
stackLayout.Children.Add(line.DrawLine());
}
ScrollView scrollView = new ScrollView ()
{
Content = stackLayout
};
contentPage.Content = scrollView;
return contentPage;
}
The method call line.DrawLine();
returns a View that is converted from Markdown. For example, BodyPageLine
has a DrawLine method that returns a Label with the content of the line:
public class BodyPageLine : IPageLine
{
public string LineContents { get; set; }
public View DrawLine()
{
var label = new Label();
label.Font = Font.SystemFontOfSize(NamedSize.Medium);
label.Text = LineContents;
return label;
}
}
Hopefully, this is an issue that can be solved easily!
Thanks,
Richard