I have a scrollviewer with a standard margin(0,0,0,0). If I click on the button the margin for the scrollviewer needs to be margin(0,0,0,90). How can I do this in the code?

有帮助吗?

解决方案

 YourScroller.Margin = new Thickness(0,0,0,90);

On your button click

其他提示

I assume mainscrollviewer is your scrollviewer x:name

//Button click
 private void ButtonClick_Click_1(object sender, RoutedEventArgs e)
        {
            mainscrollviewer.Margin = new Thickness(0, 0, 0, 90);
        }

On your button click set it programatically:

 ScrollViewer.Margin = new System.Windows.Thickness(0, 0, 0, 90);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top