关于scrollview控件赋值没有立即响应的问题~在线等待~
<Window x:Class="test5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:test5"
Title="MainWindow" Height="573" Width="602">
<Grid>
<Button Click="GoToLake" Margin="207,34,210,380">Go to Lake</Button>
<ScrollViewer Name="sv1" Width="370" Height="300" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Margin="84,186,196,48">
<TextBlock Width="800" Name="mapframe" ScrollViewer.CanContentScroll="True">
sadafafdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsa
sadafafdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsa
</TextBlock>
</ScrollViewer>
</Grid>
</Window>
private void GoToLake(object sender, RoutedEventArgs e)
{
sv1.ScrollToHorizontalOffset(440);
double wid1 = sv1.ViewportWidth;
double wid2 = sv1.ScrollableWidth;
double wid3 = sv1.HorizontalOffset;
double wid4 = sv1.ExtentWidth;
double wid5 = sv1.ContentHorizontalOffset;
}
我是在探究Scrollview控件的几个属性值,但是发现了一个问题~我在调试中:
会发现虽然前面,sv1.ScrollToHorizontalOffset(440);已经移动了,但是wid3 ,wid5 并没有发现这种改变,他们的值还是0,这是什么原因? wpf scrollview --------------------编程问答-------------------- 求给力~大仙们快来~
补充:.NET技术 , 组件/控件开发