Is there a scrollView in phone7?
I have this code
private void button8_Click(object sender, RoutedEventArgs e)
{
for (int i=0; i<23; i++) {
Button btn = new Button() {
Content="newbutton "+i,
HorizontalAlignment =HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 20+(i*60), 0, 0),
};
btn.Click += new RoutedEventHandler(btn_click);
ContentPanel.Children.Add(btn);
}
}
to add 23 buttons to my screen, what is the way to scrolling down the page to show all of the 23 buttons?
I’m assuming
ContentPanelis aStackPanel.In XAML:
You can use the
ScrollViewer.ScrollToVerticalOffsetmethod to scroll to the end of the page.However, if you have other
UIElements above theScrollViewerthose will still occupy the top of your screen with only the section occupied by theScrollViewerbeing scrolled. To prevent that you’ll have to have all theUIElements, including ContentPanel, be placed in theScrollViewer.