Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2145
Another Gantt question, colouring calender columns.
posted

Hi All,

Sorry to bother you again, got another Gantt question, which I thought would be easy, however it is turning out to be not so.

I have set a MaxRange on the gantt chart. That works fine in that it won't set any tasks beyond that date but what I can't do disabled appearance for the dates after the max range to make it obvious to a user they cannot put any dates there. I would have thought it would do that by default.

I looked for an easy way to do this, but A) there appears to be no property settings for "DatesAfterMaxRange.Appearance" or B) No calendar.Initilize column event that I can use to set the appearance (The header init does not cut it).

If there is something I have not found to do this, then please let me know.

I tried to work around this by using a creation filter which don't seem to do anything (though I know through stepping into the code, that it does hit the change colour line) see below:

Imports Infragistics.Win

Imports Infragistics.Win.Misc

Imports Infragistics.Win.UltraWinGanttView

Imports Infragistics.Win.UltraWinSchedule.TimelineView

Imports Infragistics.Win.UltraWinGanttView.UIElements

Public Class TimelineCreationFilter : Implements IUIElementCreationFilter

    Private appearance As AppearanceBase = Nothing

    Public Sub AfterCreateChildElements(parent As UIElement) Implements IUIElementCreationFilter.AfterCreateChildElements      

   'Keep going until the parent is a Task Area UI Element.        

    If TypeOf (parent) Is TaskAreaUIElement Then

          Dim TaskAreaElement As TaskAreaUIElement

          Dim TimeSlotElement As TimeSlotUIElement

          TaskAreaElement = parent

          'Get the time slot element            

          TimeSlotElement = TaskAreaElement.GetDescendant(GetType(TimeSlotUIElement), gstartdate.AddMonths(gsettings.getSetting("MonthRange")))

          If IsNothing(TimeSlotElement) = False Then                

                If IsNothing(Me.appearance) = True Then

                    Me.appearance = New Infragistics.Win.Appearance()

                End If

                 'Colour it grey to show it is outside of the max range.

                 Me.appearance.BackColor = Color.Silver

                 Me.appearance.BorderColor = Color.Black

             End If

         End If

   End Sub

    Public Function BeforeCreateChildElements(parent As UIElement) As Boolean Implements IUIElementCreationFilter.BeforeCreateChildElements

        Return False    

End Function