我有这个 ScrollViewer,我以编程方式向其中添加元素:
<ScrollViewer VerticalSnapPointsAlignment="Near"
VerticalSnapPointsType="Mandatory"
VerticalScrollMode="Enabled"
VerticalScrollBarVisibility="Hidden"
ZoomMode="Disabled"
Width="400"
Height="400"
x:Name="MainFeatureScrollViewer"
ViewChanging="ScrollViewer_ViewChanging">
<StackPanel x:Name="MainFeatureStackPanel" />
</ScrollViewer>
当我像下面这样调用 ChangeView 时,它返回 false 并且没有任何反应。为什么这不起作用?
bool result = this.MainFeatureScrollViewer.ChangeView(null, 400, null, true);