Slow performance after awhile

2 posts, 0 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 11 Nov 2014 Link to this post

    I have an editable GridView and it works fine adding new rows until I reach the bottom (about 15 rows).
    Then adding a new row takes over four seconds.
    I have used JustTrace to see what is going on and its all about redrawing the different part of the grid.
    I have tried with row virtualization on or off with no difference.

    Here is my grid:
    <soe:SOEGridView x:Name="DataGrid" Grid.Row="3" Style="{StaticResource EditableSOEGridView}"
                             ItemsSource="{Binding Shifts, Source={StaticResource ViewModel}}"
                             SelectedItem="{Binding CurrentShift, Source={StaticResource ViewModel}, Mode=TwoWay}"
                             RowIndicatorVisibility="Collapsed" IsFilteringAllowed="False" ShowColumnFooters="False"
                             IsReadOnly="{Binding EditPermission, Converter={StaticResource BooleanInvertConverter}}"
                             EnableColumnVirtualization="True"
                             EnableRowVirtualization="True"
                             Margin="0,-1,0,0"
                             RowLoaded="DataGrid_RowLoaded" AddingNewDataItem="DataGrid_AddingNewDataItem" Deleted="DataGrid_Deleted"
                             CurrentCellChanged="DataGrid_CurrentCellChanged" PreparingCellForEdit="DataGrid_PreparingCellForEdit" CellEditEnded="DataGrid_CellEditEnded" RowEditEnded="DataGrid_RowEditEnded">
                <telerik:RadGridView.Resources>
                    <local:IsBreakStyleSelector x:Key="IsBreakStyleSelector" />
                    <Style TargetType="TextBlock">
                        <!-- Remove implicit style on TextBlock -->
                    </Style>
                    <Style TargetType="CheckBox" BasedOn="{StaticResource GridView_CheckBox}">
     
                    </Style>
                    <Style TargetType="Border" x:Key="StatusBorderStyle">
                        <Setter Property="BorderBrush" Value="{StaticResource ContentBorderBrush}" />
                        <Setter Property="BorderThickness" Value="1,0,1,0" />
                        <Setter Property="Height" Value="25" />
                        <Setter Property="Margin" Value="-6,-1,-3,0" />
                    </Style>
                    <Style TargetType="telerik:RadComboBox">
                        <Setter Property="Height" Value="22" />
                        <Setter Property="Width" Value="148" />
                        <Setter Property="IsEditable" Value="True" />
                        <Setter Property="TextSearchMode" Value="Contains" />
                        <Setter Property="IsReadOnly" Value="False" />
                        <Setter Property="OpenDropDownOnFocus" Value="True" />
                    </Style>
                </telerik:RadGridView.Resources>
     
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="" Width="25" IsReadOnly="True" TabStopMode="Skip" IsResizable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding IsModified, Converter={StaticResource BooleanToAsteriskConverter}}" Foreground="{StaticResource SelectedBrush}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="10" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="" DataMemberBinding="{Binding ShiftUserStatus}" MinWidth="10" Width="10" IsReadOnly="True" TabStopMode="Skip" IsResizable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <Border Style="{StaticResource StatusBorderStyle}" Background="{Binding ShiftUserStatus, Converter={StaticResource ShiftUserStatusBackgroundColorConverter}}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewCheckBoxColumn Header="Rast" DataMemberBinding="{Binding IsBreak}" Width="40" EditorStyle="{StaticResource DefaultStandardCheckBox}" CellStyleSelector="{StaticResource IsBreakStyleSelector}" IsResizable="False" AutoSelectOnEdit="True" TabStopMode="Stop" EditTriggers="CellClick">
                        <telerik:GridViewCheckBoxColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsBreak, Mode=TwoWay}" />
                            </DataTemplate>
                        </telerik:GridViewCheckBoxColumn.CellTemplate>
                    </telerik:GridViewCheckBoxColumn>
                    <telerik:GridViewDataColumn Header="Vecka" DataMemberBinding="{Binding DayNumber}" Width="45" IsReadOnly="True" TabStopMode="Skip" IsResizable="False" TextAlignment="Right">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding DayNumber, Converter={StaticResource DayNumberToWeekNumberConverter}}" TextAlignment="Right" Margin="0,0,4,0" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <soe:SOETextBox Text="{Binding DayNumber, Mode=TwoWay, Converter={StaticResource DayNumberToWeekNumberConverter}}" Width="43" IsNumeric="True" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Dag" DataMemberBinding="{Binding DayName}" Width="70" IsReadOnly="True" TabStopMode="Skip" IsResizable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding DayName, Converter={StaticResource DayOfWeekToDayNameConverter}, ConverterParameter='camelcase'}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox ItemsSource="{Binding WeekDays, Source={StaticResource ViewModel}}" SelectedValue="{Binding DayName, Mode=TwoWay}" SelectedValuePath="Field1" DisplayMemberPath="Field2" OpenDropDownOnFocus="False" Width="68">
                                    <telerik:RadComboBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VirtualizingStackPanel HorizontalAlignment="Stretch" />
                                        </ItemsPanelTemplate>
                                    </telerik:RadComboBox.ItemsPanel>
                                </telerik:RadComboBox>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Datum" DataMemberBinding="{Binding Start}" Width="102" IsResizable="False" IsVisible="{Binding ShowDateInGridView, Source={StaticResource ViewModel}}">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Start, Converter={StaticResource DateTimeConverter}}" TextAlignment="Right" Margin="0,0,4,0" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <soe:SOEDatePicker x:Name="RowDate" SelectedDate="{Binding Start, Mode=TwoWay}" Width="100" TextAlignment="Right" Margin="0" SelectionChanged="RowDate_SelectionChanged" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Från" DataMemberBinding="{Binding ActualStart}" Width="45" IsResizable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ActualStart, Converter={StaticResource TimeConverter}}" TextAlignment="Right" Margin="0,0,4,0">
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="{Binding ActualStart, Converter={StaticResource DateTimeConverter}, ConverterParameter='short_short'}" />
                                    </ToolTipService.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <soe:SOETextBox Text="{Binding ActualStart, Mode=TwoWay, Converter={StaticResource TimeConverter}}" IsTime="True" Width="43" TextAlignment="Right" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Till" DataMemberBinding="{Binding ActualEnd}" Width="45" IsResizable="False">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ActualEnd, Converter={StaticResource TimeConverter}}" TextAlignment="Right" Margin="0,0,4,0">
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="{Binding ActualEnd, Converter={StaticResource DateTimeConverter}, ConverterParameter='short_short'}" />
                                    </ToolTipService.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <soe:SOETextBox Text="{Binding ActualEnd, Mode=TwoWay, Converter={StaticResource TimeConverter}}" IsTime="True" Width="43" TextAlignment="Right" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Längd" Width="45" IsResizable="False" IsReadOnly="True" TabStopMode="Skip">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=., Converter={StaticResource TimeScheduleShiftLengthConverter}}" TextAlignment="Right" Margin="0,0,4,0" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewComboBoxColumn Header="Pass-/rasttyp" IsComboBoxEditable="True" Width="150">
                        <telerik:GridViewComboBoxColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding ShiftTypeName}">
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="{Binding ShiftTypeName}" />
                                    </ToolTipService.ToolTip>
                                </TextBlock>
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellTemplate>
                        <telerik:GridViewComboBoxColumn.CellEditTemplate>
                            <DataTemplate>
                                <Grid>
                                    <telerik:RadComboBox x:Name="RowShiftType" SelectedValue="{Binding ShiftTypeId, Mode=TwoWay}" ItemsSource="{Binding Path=ShiftTypes, Source={StaticResource ViewModel}}" SelectedValuePath="ShiftTypeId" DisplayMemberPath="Name" TextSearchMode="StartsWith" Visibility="{Binding IsBreak, Converter={StaticResource VisibilityConverter}, ConverterParameter='inverse'}">
                                        <telerik:RadComboBox.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <VirtualizingStackPanel HorizontalAlignment="Stretch" />
                                            </ItemsPanelTemplate>
                                        </telerik:RadComboBox.ItemsPanel>
                                    </telerik:RadComboBox>
                                    <telerik:RadComboBox x:Name="RowBreakTimeCode" SelectedValue="{Binding Break1Id, Mode=TwoWay}" ItemsSource="{Binding Path=BreakTimeCodes, Source={StaticResource ViewModel}}" SelectedValuePath="TimeCodeId" DisplayMemberPath="Name" TextSearchMode="StartsWith" Visibility="{Binding IsBreak, Converter={StaticResource VisibilityConverter}}" OpenDropDownOnFocus="False">
                                        <telerik:RadComboBox.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <VirtualizingStackPanel HorizontalAlignment="Stretch" />
                                            </ItemsPanelTemplate>
                                        </telerik:RadComboBox.ItemsPanel>
                                    </telerik:RadComboBox>
                                </Grid>
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellEditTemplate>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewComboBoxColumn Header="Schematyp" IsComboBoxEditable="True" DataMemberBinding="{Binding TimeScheduleTypeId}" ItemsSource="{Binding Path=TimeScheduleTypes, Source={StaticResource ViewModel}}" SelectedValueMemberPath="TimeScheduleTypeId" DisplayMemberPath="Name" Width="150" IsVisible="{Binding ShowTimeScheduleType, Source={StaticResource ViewModel}}">
                        <telerik:GridViewComboBoxColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding TimeScheduleTypeName}" />
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellTemplate>
                        <telerik:GridViewComboBoxColumn.CellEditTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox SelectedValue="{Binding TimeScheduleTypeId, Mode=TwoWay}" ItemsSource="{Binding Path=TimeScheduleTypes, Source={StaticResource ViewModel}}" SelectedValuePath="TimeScheduleTypeId" DisplayMemberPath="Name" SelectionChanged="RowTimeScheduleType_SelectionChanged">
                                    <telerik:RadComboBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VirtualizingStackPanel HorizontalAlignment="Stretch" />
                                        </ItemsPanelTemplate>
                                    </telerik:RadComboBox.ItemsPanel>
                                </telerik:RadComboBox>
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellEditTemplate>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewComboBoxColumn Header="Anställd" IsComboBoxEditable="True" DataMemberBinding="{Binding EmployeeId}" ItemsSource="{Binding Path=Employees, Source={StaticResource ViewModel}}" SelectedValueMemberPath="EmployeeId" DisplayMemberPath="Name" Width="150" IsVisible="{Binding ShowEmployeeInGridView, Source={StaticResource ViewModel}}">
                        <telerik:GridViewComboBoxColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding EmployeeName}" />
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellTemplate>
                        <telerik:GridViewComboBoxColumn.CellEditTemplate>
                            <DataTemplate>
                                <telerik:RadComboBox SelectedValue="{Binding EmployeeId, Mode=TwoWay}" ItemsSource="{Binding Path=Employees, Source={StaticResource ViewModel}}" SelectedValuePath="EmployeeId" DisplayMemberPath="Name" SelectionChanged="RowEmployee_SelectionChanged">
                                    <telerik:RadComboBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VirtualizingStackPanel HorizontalAlignment="Stretch" />
                                        </ItemsPanelTemplate>
                                    </telerik:RadComboBox.ItemsPanel>
                                </telerik:RadComboBox>
                            </DataTemplate>
                        </telerik:GridViewComboBoxColumn.CellEditTemplate>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewDataColumn Header="Beskrivning" DataMemberBinding="{Binding Description}" Width="*">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Description}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <soe:SOETextBox Text="{Binding Description, Mode=TwoWay}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn Header="Orsak" DataMemberBinding="{Binding TimeDeviationCauseName}" Width="*">
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding TimeDeviationCauseName}" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewCheckBoxColumn Header="Prel" DataMemberBinding="{Binding IsPreliminary}" Width="40" EditorStyle="{StaticResource DefaultStandardCheckBox}" IsResizable="False" TabStopMode="Skip" AutoSelectOnEdit="True" EditTriggers="CellClick" />
                    <telerik:GridViewColumn Width="26" IsReadOnly="True" TabStopMode="Skip" IsResizable="False" IsVisible="{Binding ShowLinkButtonColumn, Source={StaticResource ViewModel}}">
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Border Opacity="0.4" />
                                    <soe:RadImageButton Style="{StaticResource GridViewRowButton}" ImageSource="/Soe.Silverlight;Component/img/16/link.png" ImageMargin="4,1,0,0" Visibility="{Binding IsBreak, Converter={StaticResource VisibilityConverter}, ConverterParameter='inverse'}" Click="ButtonUnlink_Click" />
                                </Grid>
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                    <telerik:GridViewColumn Width="26" IsReadOnly="True" TabStopMode="Skip" IsResizable="False" IsVisible="{Binding IsReadOnly, ElementName=DataGrid, Converter={StaticResource BooleanInvertConverter}}">
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <soe:SOEHyperlinkButton Style="{StaticResource Hyperlink_DeleteRowButton}" ImageMargin="0,0,0,0" Click="ButtonDeleteRow_Click" />
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                </telerik:RadGridView.Columns>
                <telerik:RadGridView.SortDescriptors>
                    <telerik:SortDescriptor Member="SortOrder" SortDirection="Ascending" />
                </telerik:RadGridView.SortDescriptors>
            </soe:SOEGridView>

    Check screenshots for JustTrace result.

    I'm using the Silverlight 4 version, is there any known problems in that version.
    I'm not able to upgrade to the latest version at the moment.

    Regards,
    Håkan

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 13 Nov 2014 Link to this post

    Hi,

    We cannot relate this behavior to a specific known issue, but our latest version that supports Silverlight 4 was released in September 2012. There has been quite a few changes and improvement since then. As far as I can see form your account  status, you have downloaded DevCraft Complete recently. Can you please share what impedes you from upgrading to a newer version? We will be glad to assist you with the upgrade process if needed.

    Regards,
    Ivan Ivanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top