RadGridView : How to adjust a specific column width whether the scroollBar is displayed or not

1 Answer 52 Views
GridView ScrollBar
Patgat
Top achievements
Rank 2
Iron
Iron
Iron
Patgat asked on 02 Oct 2023, 12:40 PM

Hi all,

Within controls such a RadGridView, is there a simple way like a property to mark a column as able to decrease  or increase its width when the scrollbar is displayed or hidden, so that the set of columns would always fill all the parent control width without either overwritting the last column right part when the vertical scroolbar is shown or having to  show some unused reserved space when the scrollbar is hidden. 

I understand that it is always possible to use events to manually adjust each width for each control, but this is very cumbersome.

Wouldn't it nice to have a control overall property such as (hypothetically)  gridview.AdjustColumnWidthToScrollBarDisplay ?

Or what is the simplest method ?

Thanks for your answers

Patrick

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Oct 2023, 04:24 PM

Hello, Patrick,

Columns can automatically fill the entire width of the grid. Just set the AutoSizeColumnsMode property of the desired template to GridViewAutoSizeColumnsMode.Fill.

Additional information about the columns resizing options in RadGridView is available here:

https://docs.telerik.com/devtools/winforms/controls/gridview/columns/resizing-columns-programatically 

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

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.

Patgat
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Oct 2023, 04:33 PM

Hi Dess,

This works fine. However, I didn't find any explanation regarding how the adjustment is done.

As I am using fixed size columns, how could I ensure that the width adjustment is done on a specific column (let's say the 'product name' one  as an example).

Thanks

Patrick

 

Dess | Tech Support Engineer, Principal
Telerik team
commented on 11 Oct 2023, 02:57 PM

Hi, Patrick,

Usually, the width adjustment is distributed proportionally to the columns when the AutoSizeColumnsMode property is set to Fill. If you want to ensure minimum width for a certain column, note that you can set the column's MinWidth.The following help articles gives more details on this topic:

https://docs.telerik.com/devtools/winforms/controls/gridview/columns/resizing-columns-programatically 

I hope it will be helpful.

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