Ayuda con error en Telerik.WinControls.UI.GridCommandCellElement.Detach()

3 Answers 29 Views
GridView
Martin
Top achievements
Rank 1
Iron
Martin asked on 25 Jan 2024, 07:36 PM
   at Telerik.WinControls.UI.GridCommandCellElement.Detach() in Telerik.WinControls.UI\GridCommandCellElement.cs:line 41
   at Telerik.WinControls.UI.BestFitHelper.Detach(IVirtualizedElementProvider`1 cellElementProvider, GridCellElement cell) in Telerik.WinControls.UI\BestFitHelper.cs:line 388
   at Telerik.WinControls.UI.BestFitHelper.MeasureCell(GridViewRowInfo row, GridViewColumn column, BestFitColumnMode mode) in Telerik.WinControls.UI\BestFitHelper.cs:line 257
   at Telerik.WinControls.UI.BestFitHelper.CalculateColumnWidth(GridViewColumn column, BestFitColumnMode mode) in Telerik.WinControls.UI\BestFitHelper.cs:line 203
   at Telerik.WinControls.UI.BestFitHelper.BestFitColumnsCore(Nullable`1 mode) in Telerik.WinControls.UI\BestFitHelper.cs:line 139
   at Telerik.WinControls.UI.BestFitHelper.ProcessRequests() in Telerik.WinControls.UI\BestFitHelper.cs:line 76
   at Telerik.WinControls.UI.RowsContainerElement.MeasureOverride(SizeF availableSize) in Telerik.WinControls.UI\RowsContainerElement.cs:line 211
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureViewElement(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureView(SizeF availableSize)
   at Telerik.WinControls.UI.ScrollViewElement`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.UI.GridTableElement.MeasureOverride(SizeF availableSize) in Telerik.WinControls.UI\GridTableElement.cs:line 2396
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.DockLayoutPanel.MeasureOverride(SizeF constraint)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.LightVisualElement.MeasureElements(SizeF availableSize, SizeF clientSize, Padding borderThickness)
   at Telerik.WinControls.UI.LightVisualElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.RadElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)
   at Telerik.WinControls.RadControl.GetRootElementDesiredSize(Int32 x, Int32 y, Int32 width, Int32 height)
   at Telerik.WinControls.RadControl.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
   at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
   at System.Windows.Forms.Layout.DefaultLayout.ApplyCachedBounds(IArrangedElement container)
   at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
   at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
   at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
   at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
   at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
   at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
   at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
   at System.Windows.Forms.Control.OnResize(EventArgs e)
   at System.Windows.Forms.Panel.OnResize(EventArgs eventargs)
   at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.UI.RadPageViewPage.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

3 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 26 Jan 2024, 11:15 AM

Hello, Martin,

Thank you for the provided stack trace. However, it is not enough to reproduce the error. Can you please elaborate? Is it possible to provide a sample runnable project that can reproduce this problem? Without reproducing the problem, it would be difficult to understand why exactly is happening and provide further assistance. Thank you for your understanding.

Looking forward to your reply.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Martin
Top achievements
Rank 1
Iron
answered on 26 Jan 2024, 12:52 PM

Hola,

Comprendo, pero lamentablemente no puedo proporcionar el código. Según pude reproducir en mis pruebas, asumo que el error se produce en un formulario con un RadGridview con varias columnas (y particularmente 3 GridViewCommandColumn). 

La RadGridview se redimensiona junto con el Form y cambiar el tamaño del formulario o activarlo se producía el error:

En el evento Load del formulario tenía el siguiente código, y al eliminarlo no se produjo más el error:

RadGridview 1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.None
RadGridview 1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.HeaderCells)

Espero les sirva de ayuda, la versión es 2023.1.117.40

Saludos!

0
Nadya | Tech Support Engineer
Telerik team
answered on 31 Jan 2024, 11:47 AM

Hello, Martin,

Thank you for the provided additional information. Following it, I was able to reproduce the exception on my end when adding GridViewCommandColumn to the grid and use the BestFitColumns method. I have logged it on our feedback portal by creating a public thread on your behalf. Here you can find the feedback item. Make sure that you subscribe to the item to receive notifications when its status has changed, you can also vote for the item, or add your comments there. 

I have also updated your Telerik Points for this report.

To workaround this issue, you can create a custom GridCommandCellElement and override its Detach method. You should also replace the default command cell with the custom one in CreateCell event:

Private Sub RadGridView1_CreateCell(sender As Object, e As GridViewCreateCellEventArgs)
    If e.CellType Is GetType(GridCommandCellElement) Then
        e.CellElement = New MyGridCommandCellElement(e.Column, e.Row)
    End If
End Sub

Public Class MyGridCommandCellElement
    Inherits GridCommandCellElement
    Public Sub New(column As GridViewColumn, row As GridRowElement)
        MyBase.New(column, row)
    End Sub
    Public Overrides Sub Detach()
        If Me.CommandButton IsNot Nothing Then
            Me.CommandButton.Image = Nothing
        End If
    End Sub
End Class

Off topic, I would like to note that the official language for all product resources, e.g. online documentation, submitting tickets or comments in our forum, etc., is English. Can you please submit your future posts or comments in English? Thank you for your understanding. 

I hope this helps. If you have any other questions, please let me know.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Martin
Top achievements
Rank 1
Iron
Share this question
or