RadGridView locked/frozen

2 posts, 0 answers
  1. Oreades
    Oreades avatar
    4 posts
    Member since:
    Nov 2013

    Posted 27 Aug 2015 Link to this post

    Hi Team,

    I have a problem with Telerik RadGridView 2015.1.225.40 version on Windows 7 64 bits. In my application I show a virtualized grid with a large number of columns (up to 45 although the user can select the columns to see). Data types are showing dates, text, images, combos, etc. The number of rows can vary but usually not more than 40.

    The columns are created dynamically in the ViewModel. Depending on the type of data to show, a different type of column is used. To show simple data is used GridViewDataColumn but to show more specific data (e.g. dates) types of custom columns are used. An example is:

    var colduracion = new RadTimePickerColumn();
     
    colduracion.Width = tamano;
    colduracion.MinWidth = 40.0;
    colduracion.UniqueName = col.Columna.Id.ToString();
    colduracion.Header = " " + col.Nombre + " ";
    if (binding.Path.Path != string.Empty)
    {
        colduracion.DataMemberBinding = binding;
    }
    colduracion.IsFilterable = true;
    colduracion.IsSortable = true;
    colduracion.IsReadOnly = !col.Columna.Editable;
     
    if (col.Columna.Orden == 0)
    {
        colduracion.IsVisible = false;
    }
     
    this.grid.Columns.Add(colduracion);

    The RadTimePickerColumn type is declared as follows:

    internal class RadTimePickerColumn : GridViewBoundColumnBase
    {
        #region Fields
        /// <summary>
        /// Campo que controla lo que se pinta.
        /// </summary>
        private MediaTextBox mediaTextBox = null;
     
        /// <summary>
        /// Campo que controla lo que se pinta en modo de edición.
        /// </summary>
        private MediaTextBox mediaTextBoxEdit = null;
        #endregion
     
        #region Methods
        /// <summary>
        /// Crea el cóntenido de la celda en modo solo lectura.
        /// </summary>
        /// <param name="cell">Celda de la que se crea el contentido.</param>
        /// <param name="dataItem">Origen de datos.</param>
        /// <returns>Contenido de la celda,</returns>
        public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
            this.mediaTextBox = this.CreateElement(dataItem);
     
            return this.mediaTextBox;
        }
     
        /// <summary>
        /// Get New Value From Editor
        /// </summary>
        /// <param name="editor"> editor Element</param>
        /// <returns>object Element re</returns>
        public override object GetNewValueFromEditor(object editor)
        {
            var mts = editor as MediaTextBox;
     
            if (mts != null)
            {
                return mts.Time;
            }
            else
            {
                return null;
            }
        }
     
        /// <summary>
        /// Update Source With Editor Value
        /// </summary>
        /// <param name="gridViewCell"> editor Element</param>
        /// <returns>object Element re</returns>
        public override IList<string> UpdateSourceWithEditorValue(GridViewCell gridViewCell)
        {
            List<string> errors = new List<string>();
     
            var editor = gridViewCell.GetEditingElement() as MediaTextBox;
            var bindingExpression = editor.ReadLocalValue(MediaTextBox.TimeProperty) as BindingExpressionBase;
             
            if (bindingExpression != null)
            {
                bindingExpression.UpdateSource();
                errors.AddRange(Validation.GetErrors(editor).Select(d => d.ErrorContent.ToString()).ToList());
            }
     
            return errors;
        }
     
        /// <summary>
        /// Create Cell Edit Element
        /// </summary>
        /// <param name="cell"> Cell Edit Element</param>
        /// <param name="dataItem">data Item</param>
        /// <returns>Framework Element</returns>
        public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            this.mediaTextBoxEdit = this.CreateElement(dataItem);
            this.mediaTextBoxEdit.IsReadOnly = false;
            return this.mediaTextBoxEdit;
        }
     
        /// <summary>
        /// Crea el control para pintar la celda.
        /// </summary>
        /// <param name="dataItem">Origen de datis.</param>
        /// <returns>Control utilizado para pintar el valor.</returns>
        private MediaTextBox CreateElement(object dataItem)
        {
            var mediaTextBox = new MediaTextBox
            {
                AutoValidateTime = true,
                FractionAdjust = FractionAdjust.Truncate,
                FractionSeparator = '.',
                Fps = 25,
                IsReadOnly = true,
                Height = 20,
                TimeFormat = MediaTimeSpanStringFormat.HHmmssff,
                Width = 100
            };
     
            if (dataItem is Dto.MediaUIDto)
            {
                mediaTextBox.SetBinding(MediaTextBox.FpsProperty, "Fps");
            }
     
            var binding = new Binding(this.DataMemberBinding.Path.Path);
            binding.Mode = BindingMode.TwoWay;
            binding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;
     
            mediaTextBox.SetBinding(MediaTextBox.TimeProperty, binding);
     
            return mediaTextBox;
        } // CreateElement
        #endregion
    }


    RadGridView creation is performed as follows. Caliburn.Micro version 1.5.2 is used:

    <telerik:RadGridView x:Name="GridFilasGrid"
                         Margin="-2,48,0,48"
                         AlternationCount="2"
                         AutoGenerateColumns="False"
                         CanUserDeleteRows="False"
                         CanUserFreezeColumns="True"
                         CanUserInsertRows="False"
                         EnableColumnVirtualization="True"
                         EnableRowVirtualization="False"
                         FocusVisualStyle="{x:Null}"
                         GridLinesVisibility="Both"
                         IsReadOnly="True"
                         ItemsSource="{Binding FilasGrid,
                                               Mode=TwoWay,
                                               NotifyOnSourceUpdated=True}"
                         ScrollMode="Deferred"
                         RowIndicatorVisibility="Collapsed"
                         SelectedItem="{Binding Path=FilaSeleccionada,
                                                Mode=TwoWay}"
                         SelectionMode="Single"
                         ShowGroupPanel="False"
                         Style="{DynamicResource EstiloRejillaDatos}"
                         VirtualizingPanel.CacheLength="5"
                         VirtualizingPanel.CacheLengthUnit="Item"
                         VirtualizingPanel.ScrollUnit="Item"
                         VirtualizingPanel.VirtualizationMode="Recycling"
                         Visibility="Visible"
                         cal:Action.TargetWithoutContext="{Binding DataContext,
                                                                   ElementName=LayoutRoot}"
                         cal:Message.Attach="[Event Loaded] = [Action GridResultadoLoaded ($source, $eventargs)];
                                             [Event MouseRightButtonUp] = [Action OnMouseRightButtonUp ($source, $eventargs)];
                                             [Event MouseDown] = [Action OnMouseDown ($source, $eventargs)];
                                             [Event MouseUp] = [Action OnMouseUp ($source, $eventargs)];
                                             [Event CellValidating] = [Action OnCellValidating ($source, $eventargs)];
                                             [Event CellValidated] = [Action OnCellValidated ($source, $eventargs)];
                                             [Event BeginningEdit] = [Action OnBeginningEdit ($source, $eventargs)];
                                             [Event ColumnReordered] = [Action OnColumnReordered ($source, $eventargs)];
                                             [Event SelectionChanged] = [Action OnSelectionChanged ($source, $eventargs)]">           
        <telerik:RadRadialMenu.RadialContextMenu>
            <telerik:RadRadialMenu x:Name="RadContextMenu"
                                   ItemsSource="{Binding RadialMenuItems}"                                      
                                   StaysOpenOnShow="True"
                                   PopupPlacement="MousePoint"
                                   IsOpen="True"
                                   OuterRadiusFactor="1"
                                   Height="300"
                                   Width="300">
                <telerik:RadRadialMenu.Resources>
                    <Style TargetType="telerik:NavigationItemButton">
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="Background" Value="DarkOrange"/>
                    </Style>
                    <Style TargetType="telerik:VisualStatesItemPresenter">
                        <Setter Property="Background" Value="DarkOrange"/>
                        <Setter Property="ThicknessFactor" Value="0.2"/>
                        <Setter Property="ArrowThicknessFactor" Value="0.3"/>
                    </Style>                       
                    <Style TargetType="telerik:RadRadialMenuItem">
                        <Setter Property="FontSize" Value="10"/>
                        <Setter Property="FontFamily" Value="Tahoma"/>
                    </Style>
                </telerik:RadRadialMenu.Resources>
            </telerik:RadRadialMenu>               
        </telerik:RadRadialMenu.RadialContextMenu>
    </telerik:RadGridView>


    The problem is when,  in some cases seemingly random, moving the horizontal or vertical movement the application is apparently locked (frozen). But if not completely so that is almost unmanageable. CPU consumption of the process is triggered by 3% to 25% normal use. One solution is to close the tab where the grid is contained and reopen.

    What could be happening?

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 27 Aug 2015 Link to this post

    Hi,

    Can you please try some modifications, so that we can pinpoint the source of the issue? Does setting fixed column widths affect the performance? Do you have frozen columns or column groups? If so, does removing them make any relevant change? Can you please try disabling the row alternation, by not setting alternation count? You can also remove the attached properties of VirtualizingPanel from RadGridView's definition.

    Regards,
    Ivan Ivanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top