0

所以我決定從Windows Phone 8.0遷移到Windows Phone 8.1 API - 不是silverlight。 原因是我想使用Silverlight 8.1或WP 8.0不支持的Win2D繪圖庫。奇怪的事情正在發生。 簡單樞軸視圖令人難以置信的滯後,也不能正確顯示視圖。 我使用最新的Visual Studio 2015年在我聯繫你可以看到以下頁面XAML代碼(只是用於測試)的結果視頻:Windows Phone 8.1 Pivot有什麼問題? (WinRT - 不是Silverlight)

<Page 
x:Class="Apptest2.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:Apptest2" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" 
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 
    <StackPanel Grid.Column="0"> 
     <Button Content="Go" 
       /> 
    </StackPanel> 
    <Pivot Grid.Row="1" 
      x:Name="PivotView" 
      Margin="10,0,10,15" 
      CacheMode="BitmapCache" 
      VerticalContentAlignment="Stretch"> 
     <PivotItem Header="item1"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 
     <PivotItem Header="item2"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 
     <PivotItem Header="item3"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 
     <PivotItem Header="item4"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 
     <PivotItem Header="item5"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 
     <PivotItem Header="item6"> 
      <Grid Background="BlueViolet" /> 
     </PivotItem> 


    </Pivot> 
</Grid> 
</Page> 

有沒有人能告訴什麼是怎麼回事?我是否應該使用來自第三方的一些數據透視類似物,或者可能忘記在新的操作系統中使用它? 拔出我的頭髮。 任何解決方案將非常感激!

Link to video

回答

2

的問題是你在你的Pivot使用CacheMode="BitmapCache"。刪除此行後性能應該很好。

所有的緩存首先被應用到元素,它的所有子元素和BitmapCaching應該在你的調合,轉化(翻譯,拉伸,旋轉)場景中使用。如果您需要BitmapCaching,請儘量不要在根控件上使用它,在真正需要BitmapCaching的子項上使用它。

濫用CacheMode功能可能會損害性能,所以您需要真正思考自己在做什麼。如果您的可視化樹交錯緩存和未緩存的元素,那麼您實際上會導致在幕後創建多個渲染表面。未緩存的曲面使用軟件渲染,緩存的曲面使用硬件渲染。如果可以最大限度地減少渲染表面的總數並使硬件在可行的地方完成工作,那麼您的性能將是最好的。

Reference來自另一個StackOverflow回答。我希望它有幫助。

+0

非常感謝。我仍然在學習wp和WinRT框架。不過有趣的是,wp 8.0上的相同代碼使其工作沒有任何問題 –

相關問題