Making the left hand text columns a fixed width - Solution

1 Answer 31 Views
GanttView
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 11 Nov 2024, 02:56 PM

When the GanttView opens, the ratio of the text (left) side to the graphical (right) side is 50/50.

This looks strange, as there may be either lots of space to the right of the right-most column of text, or not enough space if you have lots of columns.

There may be a better way to do this, but to make the left hand (text) columns have the correct with, and stay correct, add this:

  Private Sub resetSplitter()
      Dim allColWidths = 0
      For Each c As GanttViewTextViewColumn In myGanttView.GanttViewElement.Columns
          allColWidths = allColWidths + c.Width
      Next

      If allColWidths <> 0 Then 'might still be initializing
          allColWidths += 5 'removes the horizontal scroll bar from the text part - makes the left hand side look a bit neater
          myGanttView.Ratio = allColWidths / myGanttView.Width
      End If


  End Sub

You can then call this from:

1 - the Load event, so it looks nice at the start and

2 - from the resize, so it stays looking nice:

    Private Sub myGanttView_Resize(sender As Object, e As EventArgs) Handles myGanttView.Resize
        resetSplitter()
    End Sub

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 14 Nov 2024, 08:47 AM

Hello, Ian,

Thank you for sharing your solution for making the left columns fixed width with the community. I believe it would be beneficial for anyone it may concern. I reward you Telerik Points for the effort. 

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
GanttView
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or