我正在开发一个具有全景页面的Windows Phone 7.1应用程序。
此全景页面有两个全景项目,一个带有两个文本块,另一个带有一个bing贴图控件。我还设置了一个1,5MB的图像作为全景控制背景。
这是Panorama的XAML:
<phone:PhoneApplicationPage
x:Class="XxXClass.DemoDetail"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="False" Foreground="{x:Null}" xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps">
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
<!--LayoutRoot contains the root grid where all other page content is placed-->
<Grid x:Name="LayoutRoot">
<controls:Panorama Title="Demonstation Tracker">
<controls:Panorama.Background>
<ImageBrush Stretch="Fill" ImageSource="/Images/demonstrationPanorama.png"/>
</controls:Panorama.Background>
<!--Panorama item one-->
<controls:PanoramaItem Header="Details">
<Grid Background="#73000000" Margin="0,0,0,26">
<TextBlock Height="42" Margin="8,8,174,0" TextWrapping="Wrap" Text="XXXX" VerticalAlignment="Top" FontSize="{StaticResource PhoneFontSizeLarge}"/>
<TextBlock Margin="8,54,8,8" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Height="413" Width="381" FontSize="{StaticResource PhoneFontSizeMedium}"><Run Text="xxx."/><Run Text=".."/></TextBlock>
</Grid>
</controls:PanoramaItem>
<!--Panorama item two-->
<controls:PanoramaItem Header="Map">
<Grid>
<my:Map Name="map1" Margin="0,0,0,26" Height="420" Width="420" />
</Grid>
</controls:PanoramaItem>
</controls:Panorama>
</Grid>
<!--Panorama-based applications should not show an ApplicationBar-->
</phone:PhoneApplicationPage>
我第一次导航到全景页面时,我显示的时间太长了,如果我点击后退按钮然后我回到它,它会加载得更快。
如何更快地加载全景图页面?
答案 0 :(得分:3)
1.5Mb太大了。在运行时,图像将被解压缩并存储在存储器中。这是第二次快,因为它已经在内存中。如果您使用256Mb ram定位设备,则必须减少内存使用量。
试试这些:
由于可用性,我还会考虑将bing贴图移动到不支持幻灯片的页面。
答案 1 :(得分:0)
尝试评论地图控件。我确定Map控件的问题。 我总是在后台线程中进行数据初始化。然后,当数据准备就绪时,请创建BeginInvoke并重绘UI。确保1.5 MB太大,减少它。