[英]How to improve app performance when clicking hamburger menu items in UWP?
我在我的 UWP 應用程序中為 MVVM 和漢堡菜單使用模板 10。 通常從一頁到另一頁導航需要 2 到 3 秒。 App在后台超過5小時,然后回到前台,頁面導航需要8秒。 如何減少頁面到頁面導航的延遲?
菜單項的 XAML 代碼:
```<Controls:HamburgerButtonInfo ClearHistory="True" x:Name="manifest" Selected="manifest_Selected" Unselected="manifest_Unselected" PageType="views:Manifest">
<StackPanel Orientation="Horizontal">
<BitmapIcon Width="30" Height="30" x:Name="manifesticon" Margin="10,20,0,0" UriSource="ms-appx:///Assets/ic_menu_manifest.png"/>
<TextBlock Margin="16,20,0,0" x:Name="manifesttext"
VerticalAlignment="Center"
Text="Manifest" />
</StackPanel>
</Controls:HamburgerButtonInfo>```
CS代碼:
public void manifest_Selected(object sender, RoutedEventArgs e)
{
reportElement = new HamburgerButtonInfo();
manifesticon.Foreground = (Brush)Application.Current.Resources["HeaderBackground"];
manifesttext.Foreground = (Brush)Application.Current.Resources["HeaderBackground"];
reportElement = manifest;
if (report.IsEnabled)
{
report_Unselected(sender, e);
}
}
public void manifest_Unselected(object sender, RoutedEventArgs e)
{
manifesticon.Foreground = new SolidColorBrush(Color.FromArgb(255, 229, 229, 229));
manifesttext.Foreground = new SolidColorBrush(Color.FromArgb(255, 229, 229, 229));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.