Hello,
We are working on a WPF application. On some screens that seem very simple, load times are very long, even when there is no datas to bind.
I enclose you a basic example with a radGridView. This screen takes about 4 seconds to load on a PC windows 7 64, I5, 4GB RAM.
Can you enlighten us? We do something wrong? How can we improve the loading time?
Best regards.
in XAML :
<Window
x:Class="perfDG.CommandeRepartition"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="CommandeRepartition"
Loaded="frmRepartition_Loaded"
WindowStartupLocation="CenterScreen"
MaxHeight="700"
x:Name="frmRepartition"
SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" Text="Regroupement"></TextBlock>
<ComboBox x:Name="cbbGroupement" Margin="2"
MinWidth="150"
Grid.Row="0" Grid.Column="1"
BorderBrush="Black" BorderThickness="1" Background="White"
ItemsSource="{Binding Path=LstItemGroupementRepartition}"
SelectedValuePath="Valeur"
DisplayMemberPath="Libelle"
SelectionChanged="cbbGroupement_SelectionChanged">
</ComboBox>
<Border Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="Black"></Border>
</Grid>
<!-- Grille -->
<!-- item source listRepartition is List<T>
<telerik:RadGridView x:Name="dtaRepartition" Grid.Row="1" ItemsSource="{Binding listRepartition}" Margin="2,0,2,0"
AreRowDetailsFrozen="True"
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserFreezeColumns="False"
CanUserInsertRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserSortColumns="False"
CanUserSortGroups="False"
RowIndicatorVisibility="Collapsed"
ShowColumnHeaders="True"
GridLinesVisibility="Horizontal"
ShowGroupPanel="false"
CanUserSelect="False"
RowDetailsVisibilityMode="Collapsed"
EnableColumnVirtualization="False"
EnableRowVirtualization="False"
ShowGroupFooters="False"
ShowColumnFooters="True"
GroupRenderMode="Flat"
IsFilteringAllowed="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding libelleArticle}" Width="400"
UniqueName="libellearticle"
Header="Article" IsReadOnly="True" Focusable="False" Footer="Total"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding delai}" IsVisible="False"
Header="Delai" IsReadOnly="True" Focusable="False"
UniqueName="delai"
DataFormatString="{} {0:dd/MM/yyyy}"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding quantite}" Width="90"
UniqueName="quantite"
Header="Quantité" IsReadOnly="True" Focusable="False"
TextAlignment="Right"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding montant}" Width="120"
UniqueName="montant"
Header="Montant" IsReadOnly="True" Focusable="False"
TextAlignment="Right"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<!-- Boutons -->
<Grid Grid.Row="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Button x:Name="btnRetour" Margin="10,5" Height="60" Width="80" Click="btnRetour_Click">
<StackPanel>
<TextBlock Text="Retour" ></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</Window>
in CS :
// Loading data from a database
// form.datacontext = this
We are working on a WPF application. On some screens that seem very simple, load times are very long, even when there is no datas to bind.
I enclose you a basic example with a radGridView. This screen takes about 4 seconds to load on a PC windows 7 64, I5, 4GB RAM.
Can you enlighten us? We do something wrong? How can we improve the loading time?
Best regards.
in XAML :
<Window
x:Class="perfDG.CommandeRepartition"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="CommandeRepartition"
Loaded="frmRepartition_Loaded"
WindowStartupLocation="CenterScreen"
MaxHeight="700"
x:Name="frmRepartition"
SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" Text="Regroupement"></TextBlock>
<ComboBox x:Name="cbbGroupement" Margin="2"
MinWidth="150"
Grid.Row="0" Grid.Column="1"
BorderBrush="Black" BorderThickness="1" Background="White"
ItemsSource="{Binding Path=LstItemGroupementRepartition}"
SelectedValuePath="Valeur"
DisplayMemberPath="Libelle"
SelectionChanged="cbbGroupement_SelectionChanged">
</ComboBox>
<Border Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="Black"></Border>
</Grid>
<!-- Grille -->
<!-- item source listRepartition is List<T>
<telerik:RadGridView x:Name="dtaRepartition" Grid.Row="1" ItemsSource="{Binding listRepartition}" Margin="2,0,2,0"
AreRowDetailsFrozen="True"
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserFreezeColumns="False"
CanUserInsertRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserSortColumns="False"
CanUserSortGroups="False"
RowIndicatorVisibility="Collapsed"
ShowColumnHeaders="True"
GridLinesVisibility="Horizontal"
ShowGroupPanel="false"
CanUserSelect="False"
RowDetailsVisibilityMode="Collapsed"
EnableColumnVirtualization="False"
EnableRowVirtualization="False"
ShowGroupFooters="False"
ShowColumnFooters="True"
GroupRenderMode="Flat"
IsFilteringAllowed="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding libelleArticle}" Width="400"
UniqueName="libellearticle"
Header="Article" IsReadOnly="True" Focusable="False" Footer="Total"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding delai}" IsVisible="False"
Header="Delai" IsReadOnly="True" Focusable="False"
UniqueName="delai"
DataFormatString="{} {0:dd/MM/yyyy}"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding quantite}" Width="90"
UniqueName="quantite"
Header="Quantité" IsReadOnly="True" Focusable="False"
TextAlignment="Right"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding montant}" Width="120"
UniqueName="montant"
Header="Montant" IsReadOnly="True" Focusable="False"
TextAlignment="Right"
ShowFieldFilters="False" ShowFilterButton="False" ShowDistinctFilters="False"
/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<!-- Boutons -->
<Grid Grid.Row="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Button x:Name="btnRetour" Margin="10,5" Height="60" Width="80" Click="btnRetour_Click">
<StackPanel>
<TextBlock Text="Retour" ></TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</Window>
in CS :
// Loading data from a database
// form.datacontext = this