Windows phone 7 WP7 ScrollViewer在内容高度>;2000px
在我的项目中,我使用ScrollViewer显示一些长高度信息 我是这样使用的:Windows phone 7 WP7 ScrollViewer在内容高度>;2000px,windows-phone-7,xaml,windows-phone,scrollviewer,Windows Phone 7,Xaml,Windows Phone,Scrollviewer,在我的项目中,我使用ScrollViewer显示一些长高度信息 我是这样使用的: <Grid Grid.Row="1" Height="630"> <ScrollViewer Background="Red" Grid.Row="1"> <Grid> <Rectangle Height="3000" Fill="LightBlue" Width="440"/> </Gr
<Grid Grid.Row="1" Height="630">
<ScrollViewer Background="Red" Grid.Row="1">
<Grid>
<Rectangle Height="3000" Fill="LightBlue" Width="440"/>
</Grid>
</ScrollViewer>
</Grid>
但是,不幸的是,当scrollView栏的垂直高度>2000时,rectagnle不会完全显示
我已经测试了没有网格作为ScrollViewer的内容,只有矩形,结果是一样的
这个错误也发生在宽度上
你知道解决办法是什么吗?如何处理
这是同一个问题,没有任何修正
提前感谢!
-吉米
测试完整xaml为:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid Grid.Row="1" Height="630">
<ScrollViewer Background="Red" Grid.Row="1">
<Grid>
<Rectangle Height="3000" Fill="LightBlue" Width="440"/>
</Grid>
</ScrollViewer>
</Grid>
</Grid>
如果它只是一个文本,您可以使用此自定义控件:。否则,将内容分成大小小于2048的块 UPD: 2048px是GPU缓存图形的限制。您可以在scrollviewer(总计>2048)中使用许多控件(<2048)。在某些情况下一切正常,但在某些情况下则不然 例如:
<ScrollViewer Background="#4FFF6060">
<Grid Background="#FFFF8A8A" Width="240" HorizontalAlignment="Left" d:LayoutOverrides="Height">
<Rectangle Fill="Blue" Height="4000" VerticalAlignment="Top" Width="120" HorizontalAlignment="Left"/>
<Rectangle Fill="Red" Height="2000" VerticalAlignment="Top" Width="120" HorizontalAlignment="Right"/>
<Rectangle Fill="Red" Height="2000" VerticalAlignment="Top" Width="120" HorizontalAlignment="Right" Margin="0,2000,0,0"/>
</Grid>
</ScrollViewer>
在本例中,蓝色矩形以2048px剪切,但两个高度为2000px的矩形一个置于另一个之上看起来很好
第二个示例使用StackPanel显示4000px区域,它也可以工作
<StackPanel Background="#FFFF8A8A" HorizontalAlignment="Right" Width="240" d:LayoutOverrides="Height">
<Rectangle Fill="#FF88FF00" Height="2000" Width="240" HorizontalAlignment="Right"/>
<Rectangle Fill="#FF88FF00" Height="2000" VerticalAlignment="Top" Width="240" HorizontalAlignment="Right"/>
</StackPanel>
WP7上的最大纹理大小为2048x2048。矩形高度超过此限制。一旦你把它降低到这个极限以下,它就会开始工作 此代码更适合于实验,因为您可以识别底部边界:
<Grid Grid.Row="1" Height="630">
<ScrollViewer Background="Red" Grid.Row="1">
<Grid>
<Border Height="2048" BorderBrush="Blue" BorderThickness="5">
<Rectangle Height="2000" Fill="LightBlue" Width="440"/>
</Border>
</Grid>
</ScrollViewer>
</Grid>
增加边框高度后,底部将消失
另一方面,我不得不说,这种行为也让我感到惊讶。我希望系统将大型对象分解为较小的纹理,但显然WP7设计师决定不这样做,而是显示UI错误。是否有固定的最大大小值2048?实际上,在我的项目中,Rectange place是一个网格面板,包含一些子控件。谢谢,我正在考虑将崩溃的网格拆分为更多子控件。谢谢,我正在考虑将崩溃的网格拆分为更多子控件。