c# - 在 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));
}
解决方案
推荐阅读
- javascript - 如何从 Angular 组件中的变量显示 HTMLElement?
- java - 错误:无法在单个 dex 文件中容纳请求的类(# 方法:67451 > 65536)
- gcc - 如何更改 GCC 编译器的选项?
- docker - 在图像修剪期间,过滤器是否适用于未使用的图像或悬空图像或两者?
- mongodb - 无法将对象添加为另一个现有 JSON 对象的子字段
- http - Arduino UNO 和调制解调器 Sim800L - 发送查询参数时出现 DNS 错误
- python - 如何在 tkinter 中清除 FigureCanvasTkAgg 画布
- mongodb - Mongo kafka 连接器,解串器问题
- c++ - 如何使用 C++ 更新文件 txt
- visual-studio-2017 - 无法安装 System.Data.OleDb