我有一个WPF应用程序,我希望能够在刷新时了解我的组件需求:
我的页面工作正常但是当我添加这段代码时:
<Grid Grid.Row="1" Name="grid1" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="57" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="57" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="1" Margin="2,2,2,2" x:Name="textBlock1" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="2" Margin="2,2,2,2" Name="textBlock2" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="3" Margin="2,2,2,2" Name="textBlock3" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="4" Margin="2,2,2,2" Name="textBlock4" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="5" Margin="2,2,2,2" Name="textBlock5" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="2" Grid.Row="6" Margin="2,2,2,2" Name="textBlock6" Text="-" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Margin="2,2,2,2" Name="text_home" Text="1" TextAlignment="Center" FontWeight="Bold" />
<TextBlock Style="{StaticResource StyleTextes}" Margin="2,2,2,2" Grid.Column="4" Name="text_away" Text="2" TextAlignment="Center" FontWeight="Bold" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="1" Margin="2,2,2,2" Name="valeur_home_1" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="2" Margin="2,2,2,2" Name="valeur_home_2" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="3" Margin="2,2,2,2" Name="valeur_home_3" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="4" Margin="2,2,2,2" Name="valeur_home_4" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="5" Margin="2,2,2,2" Name="valeur_home_5" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="1" Grid.Row="6" Margin="2,2,2,2" Name="valeur_home_6" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="1" Margin="2,2,2,2" Name="valeur_away_1" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="2" Margin="2,2,2,2" Name="valeur_away_2" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="3" Margin="2,2,2,2" Name="valeur_away_3" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="4" Margin="2,2,2,2" Name="valeur_away_4" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="5" Margin="2,2,2,2" Name="valeur_away_5" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="3" Grid.Row="6" Margin="2,2,2,2" Name="valeur_away_6" Text="0" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="1" Margin="2,2,2,2" Name="nom_home_1" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="2" Margin="2,2,2,2" Name="nom_home_2" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="3" Margin="2,2,2,2" Name="nom_home_3" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="4" Margin="2,2,2,2" Name="nom_home_4" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="5" Margin="2,2,2,2" Name="nom_home_5" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="0" Grid.Row="6" Margin="2,2,2,2" Name="nom_home_6" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="1" Margin="2,2,2,2" Name="nom_away_1" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="2" Margin="2,2,2,2" Name="nom_away_2" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="3" Margin="2,2,2,2" Name="nom_away_3" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="4" Margin="2,2,2,2" Name="nom_away_4" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="5" Margin="2,2,2,2" Name="nom_away_5" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Grid.Column="4" Grid.Row="6" Margin="2,2,2,2" Name="nom_away_6" Text="Nom du Joueur" TextAlignment="Center" />
<TextBlock Style="{StaticResource StyleTextes}" Margin="2" Name="my_stand" Text="0" TextAlignment="Center" Grid.Column="1" />
<TextBlock Style="{StaticResource StyleTextes}" Margin="2" Name="my_stand_away" Text="0" TextAlignment="Center" Grid.Column="3" />
</Grid>
它变得非常慢。我的页面正在进行实时模拟,有时我需要(每15秒)刷新这些文本块。
我无法理解为什么这会变慢,我的意思是我在模拟一些图表或表格时,当我选择显示带有图表的页面时,它工作正常,当我想显示带有文本块的页面时真的很慢。
有没有办法分析WPF应用程序并检测哪个UI组件使用的资源最多?我已经尝试了仪器,但是,预料到它只会说Application.Run很关键。
答案 0 :(得分:-1)
Visual Studio有一个调试工具(VS2015中的alt + F2)
选择“表现助手”或“使用UC”(或其他)和“开始”
你可以看到最多的功能成本等...