Approved
Last Updated: 29 Mar 2016 14:24 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 22 Jun 2015 06:48
Category: GanttView
Type: Bug Report
1
FIX. RadGanttView - incorrect spacing between GanttViewTimelineCellElements when changing the OnePixelTime property
Please look at the attached screenshot.

Workaround: you can replace the StackLayoutElement used in the GanttViewTimelineItemBottomStackElement with a DockLayoutPanel for example as follows:

Public Class CustomGanttViewTimelineItemElement
Inherits GanttViewTimelineItemElement
    Public Sub New(data As GanttViewTimelineDataItem, graphicalViewElement As GanttViewGraphicalViewElement)
        MyBase.New(data, graphicalViewElement)

    End Sub
    Dim dock As DockLayoutPanel
    Protected Overrides Sub CreateChildElements()
        MyBase.CreateChildElements()
        dock = New DockLayoutPanel()
        dock.StretchHorizontally = True
        dock.LastChildFill = False
        Me.Children.RemoveAt(Me.Children.Count - 1)
        Me.Children.Add(dock)
    End Sub

    Protected Overrides Sub CalculateItems()
        Me.SuspendLayout()

        Dim cellInfo As GanttTimelineCellsInfo = Me.GraphicalViewElement.TimelineBehavior.GetTimelineCellInfoForItem(Me.Data, Me.GraphicalViewElement.TimelineRange)

        While Me.dock.Children.Count > cellInfo.NumberOfcells
            Me.dock.Children.RemoveAt(0)
        End While

        While Me.dock.Children.Count < cellInfo.NumberOfcells
            Dim element As LightVisualElement = Me.GraphicalViewElement.TimelineBehavior.CreateElement()
            Me.dock.Children.Add(element)
        End While

        Me.TopElement.Text = Me.GraphicalViewElement.TimelineBehavior.GetTimelineTopElementText(Me.Data)

        For i As Integer = 0 To Me.dock.Children.Count - 1
            DirectCast(Me.dock.Children(i), LightVisualElement).Text = Me.GraphicalViewElement.TimelineBehavior.GetTimelineBottomElementText(Me.Data, i + cellInfo.StartIndex)
        Next

        Me.ResumeLayout(True)
    End Sub

    Protected Overrides Function MeasureOverride(availableSize As SizeF) As SizeF
        Dim clientRect As RectangleF = Me.GetClientRectangle(availableSize)
        Dim width As Single = Me.Data.Width - Me.GraphicalViewElement.TimelineContainer.ItemSpacing + availableSize.Width - clientRect.Width

        Me.TopElement.Measure(New SizeF(width, clientRect.Height / 2.0F))
        Me.dock.Measure(New SizeF(width, clientRect.Height / 2.0F))

        Return New SizeF(width, Me.TopElement.DesiredSize.Height + Me.dock.DesiredSize.Height)
    End Function

    Protected Overrides Function ArrangeOverride(finalSize As SizeF) As SizeF
        Dim clientRect As RectangleF = Me.GetClientRectangle(finalSize)

        Dim topRect As New RectangleF(clientRect.X, clientRect.Y, Me.DesiredSize.Width, clientRect.Height / 2.0F)
        Me.TopElement.Arrange(topRect)
        Dim bottomRect As New RectangleF(clientRect.X, topRect.Bottom, Me.DesiredSize.Width, clientRect.Height - topRect.Height)
        Me.dock.Arrange(bottomRect)

        Return clientRect.Size
    End Function
End Class

Public Class CustomGanttViewTimelineElementProvider
Inherits GanttViewTimelineElementProvider

    Public Sub New(owner As GanttViewGraphicalViewElement)
        MyBase.New(owner)

    End Sub
    Public Overrides Function CreateElement(data As GanttViewTimelineDataItem, context As Object) As IVirtualizedElement(Of GanttViewTimelineDataItem)
        Dim element As GanttViewTimelineItemElement = Me.OnItemElementCreating(data)

        Return New CustomGanttViewTimelineItemElement(data, Owner)
    End Function
End Class
Attached Files:
0 comments