问题描述
||
我正在使用滚动查看器在其中显示图像。
<ScrollViewer Name=\"scrollViewer1\" Height=\"500\" Width=\"500\" HorizontalScrollBarVisibility=\"Auto\" VerticalScrollBarVisibility=\"Auto\" Padding=\"0\" >
<Image x:Name=\"img1\" Width=\"100\" Source=\"/MyApp;component/Images/Test.jpg\" />
</ScrollViewer>
但是,当我在代码中调整图像大小并立即使用scrollViewer.ScrollToHorizontalOffset()(重新放置图像)时,它不起作用:
img1.Width = 1000;
scrollViewer1.ScrollToHorizontalOffset(500);
我在img1.Width = 1000
之后验证了ScrollableWidth属性,实际上它尚未更新。因此,在调整图像大小后,我立即使用了UpdateLayout(),现在ScrollableWidth已更新:
img1.Width = 1000;
scrollViewer1.UpdateLayout();
scrollViewer1.ScrollToHorizontalOffset(500);
但是ScrollToHorizontalOffset仍然无法正常工作。如果之后执行此操作,请在另一个用户按钮上单击它。 :/
有人知道吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)