I try to add an scroll Viewer for a text block who was created from behind c#, text block was added to a stack panel stackPanel.Children.Add(text block)
. I want to do that in Windows Phone 8.0.
When make something like that:
StackPanel stackPanel = new StackPanel();
ScrollViewer sv = new ScrollViewer();
sv.Content = stackPanel;
I receive:
ExceptionObject = {"Value does not fall within the expected range."}.
One solution to solve that exception?
ScrollViewer
calculates it's scrollbars based on dimensions of child controls.
If your TextBlock
has Height
property set, remove it and ScrollBars should work as expected.
Also you should set:
sv.Content = yourTextBlock;