Resizing RadGridView

1 Answer 107 Views
GridView
Udo
Top achievements
Rank 1
Iron
Udo asked on 09 Mar 2022, 05:14 PM | edited on 11 Mar 2022, 07:23 AM

Hi there, I have a UserControl which I load into a form. On this control is a RadGridView. Unfortunately, the automatic cell resizing does not work. Only the heading is resized. Can someone help me?

Thanks Udo

Here is my code to load the UserControl


        Dim _objektdaten As New VB_Feuerbeschau.objekte
        _objektdaten = CType(Controls("ucObjekte"), objekte)
        If _objektdaten Is Nothing Then
            _objektdaten = New objekte()
            _objektdaten.Name = "ucObjekte"
            Me.Controls.Add(_objektdaten)
            _objektdaten.Dock = DockStyle.Fill
            _objektdaten.BringToFront()
           
        Else
            _objektdaten.Dispose()
            _objektdaten = Nothing
            _objektdaten = New objekte()
            _objektdaten.Name = "ucObjekte"
            Me.Controls.Add(_objektdaten)
            _objektdaten.Dock = DockStyle.Fill
            _objektdaten.BringToFront()

           
            '_objektdaten.rgvObjektdaten1.BestFitColumns(BestFitColumnMode.AllCells)
            For Each column As GridViewDataColumn In _objektdaten.rgvObjektdaten1.Columns
                column.BestFit()
            Next

        End If

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Mar 2022, 07:09 AM

Hello, Udo,

According to the provided code snippet, it seems that the UserControl.Dock property is set to Fill. This means that the UserControl will stretch and occupy the available space inside its parent container. However, it is not clear whether the UserControl >> RadGridView.Dock property is also set to Fill. Otherwise, it will remain with its serialized size. Calling the column's BestFit method is expected to size the columns according to the applied column's AutoSizeMode. Hence, it may adjust only the column headers or all the data cells.

Since, it is not clear what is the exact setup, it would be greatly appreciated if you can provide a sample runnable project demonstrating the undesired behavior that you are facing. Thus, we would be able to make an adequate analysis of the precise case and provide further assistance. Thank you in advance.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Udo
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or