我使用Windows Store-Kit来测试我的Windows Phone 8应用程序,但它失败了。它说'高资源使用率'。我正在使用MVVM-Pattern,这意味着我使用ViewModel propertys在View中绑定了我的元素。Windows Phone - 避免高资源使用率
高使用率时的示例:我有一个具有ContentControl的MainView。 ContentControl的内容是另一个View(我们称之为ChildView)。当我点击ChildView中的文本框时,会弹出InputScope(您可以键入的位置),并且视图上升,因此可以看到TextBox。当视图向上移动时(注意TextBox在透视图中),它开始落后。我不知道为什么,因为我只关注TextBox和PivotItem。我的问题是如何降低资源使用率?如果你需要任何东西,写下来,我会在这里发布。
MainPage.xaml中
<Grid>
<Grid x:Name="LayoutRoot" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ScrollViewer Name="MyScrollViewer" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" HorizontalScrollBarVisibility="{Binding Horizontal}" VerticalScrollBarVisibility="{Binding Vertical}">
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<StackPanel ScrollViewer.HorizontalScrollBarVisibility="Auto" Grid.Row="2" Opacity="50">
<ContentControl Content="{Binding MyContent}" Name="MyContentControl" IsTabStop="False" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
ChildView.xaml http://textuploader.com/?p=6&id=zMDoD
商店-Kit的结果(在德国,但我认为这是明显的)http://i.imagebanana.com/img/j6z24o9a/Unbenannt.png
这是在视图模型是什么属性该视图看起来像(其在Store-Kit结果中示出)
private string _anlohnsteuer;
public string ANLohnsteuer
{
get { return _anlohnsteuer; }
set
{
_anlohnsteuer = value;
RaisePropertyChanged(() => ANLohnsteuer);
}
}
请显示您的代码。 – Raptor 2013-04-26 09:08:39
很高兴知道它是否适用于wp8或wp7。我还记得一些关于ui总是需要响应的必要信息,但我不确定它是否仅适用于windows8应用程序或wp8。因此,也许检查一下你的代码是否会让应用程序挂起或冻结50ms(这似乎是微软的幻数),并尽量减少这种情况。也许你可以派遣一些东西并将这些长时间的呼叫分配给多个帧。 – dowhilefor 2013-04-26 09:14:46
我正在使用Windows Phone 8并且很抱歉地说这个,但是我根本不知道你的意思是什么......当我点击一个TextBox并且PivotItem正在进行时,它会“冻结”向上。 – Rudi 2013-04-26 09:32:09