'Declaration Public Event ColumnHeaderInitializing As ColumnHeaderInitializingHandler
public event ColumnHeaderInitializingHandler ColumnHeaderInitializing
The event handler receives an argument of type ColumnHeaderInitializingEventArgs containing data related to this event. The following ColumnHeaderInitializingEventArgs properties provide information specific to this event.
Property | Description |
---|---|
AppearanceData | Returns or sets an AppearanceData struct which can be used to override the resolves appearance for a particular header. |
DateTimeInterval | Returns the DateTimeInterval instance for which the column header is being displayed. |
DateTimeRange | Returns a DateTimeRange instance which describes the date/time range spanned by the header. |
HeaderElement | Returns the ColumnHeaderUIElement instance that is being initialized. |
Text | Returns or sets the text that will be displayed on the header. |
Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Public Sub ShowClocks(ByVal control As UltraTimelineView) ' Don't show any additional intervals control.AdditionalIntervals.Clear() ' Create a new TimeInterval with 15-minute intervals ' and assign it to the PrimaryInterval property. Dim primaryInterval As New TimeInterval(15, TimeIntervalUnits.Minutes) control.PrimaryInterval = primaryInterval ' Set the image alignment to middle/center control.ColumnHeaderAppearance.ImageHAlign = HAlign.Center control.ColumnHeaderAppearance.ImageVAlign = VAlign.Middle ' Set ColumnHeaderImageSize to a size that is large ' enough to display an analog clock image set the ' ColumnWidth property to a slightly larger size. control.ColumnHeaderImageSize = ClockSize control.ColumnWidth = ClockSize.Width + Padding ' Handle the ColumnHeaderInitializing event so we can ' show an image on the header instead of the text, and ' the ColumnHeaderToolTipDisplaying event so we can force ' a tooltip to be displayed. AddHandler control.ColumnHeaderInitializing, AddressOf Me.OnColumnHeaderInitializing AddHandler control.ColumnHeaderToolTipDisplaying, AddressOf Me.OnColumnHeaderToolTipDisplaying End Sub Private Sub OnColumnHeaderToolTipDisplaying(ByVal sender As Object, ByVal e As ColumnHeaderToolTipDisplayingEventArgs) ' If this is a primary interval header, show the start time ' in a tooltip, since there is no text on the header. If Not e.HeaderElement Is Nothing AndAlso e.HeaderElement.DateTimeInterval.IsPrimaryInterval Then Dim toolTipInfo As ToolTipInfo = e.ToolTipInfo toolTipInfo.ToolTipText = e.HeaderElement.DateTimeRange.StartDateTime.ToString(TimeInterval.ShortTimePattern) e.ToolTipInfo = toolTipInfo End If End Sub Private Sub OnColumnHeaderInitializing(ByVal sender As Object, ByVal e As ColumnHeaderInitializingEventArgs) If (e.DateTimeInterval.IsPrimaryInterval) Then ' Create an image of an analog clock, depicting the ' start time for this header, and assign it to the ' Image property of the e.AppearanceData Dim time As TimeSpan = e.DateTimeRange.StartDateTime.TimeOfDay Dim bmp As Bitmap = ClockImage.GetImage(time, ClockSize, Color.Black, Color.White) Dim appData As AppearanceData = New AppearanceData() appData.Image = bmp e.AppearanceData = appData ' Assign a space character to the text, so that ' nothing appears, but a tooltip can still be displayed e.Text = " " End If End Sub
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; public void ShowClocks( UltraTimelineView control ) { // Don't show any additional intervals control.AdditionalIntervals.Clear(); // Create a new TimeInterval with 15-minute intervals // and assign it to the PrimaryInterval property. TimeInterval primaryInterval = new TimeInterval(15, TimeIntervalUnits.Minutes); control.PrimaryInterval = primaryInterval; // Set the image alignment to middle/center control.ColumnHeaderAppearance.ImageHAlign = HAlign.Center; control.ColumnHeaderAppearance.ImageVAlign = VAlign.Middle; // Set ColumnHeaderImageSize to a size that is large // enough to display an analog clock image; set the // ColumnWidth property to a slightly larger size, // and set MinimumColumnResizeWidth as well so the user // can't resize the headers any smaller than that size. control.ColumnHeaderImageSize = ClockSize; control.ColumnWidth = ClockSize.Width + Padding; control.MinimumColumnResizeWidth = control.ColumnWidth; // Handle the ColumnHeaderInitializing event so we can // show an image on the header instead of the text, and // the ColumnHeaderToolTipDisplaying event so we can force // a tooltip to be displayed. control.ColumnHeaderInitializing += new ColumnHeaderInitializingHandler(this.OnColumnHeaderInitializing); control.ColumnHeaderToolTipDisplaying += new ColumnHeaderToolTipDisplayingHandler(OnColumnHeaderToolTipDisplaying); } private void OnColumnHeaderToolTipDisplaying(object sender, ColumnHeaderToolTipDisplayingEventArgs e) { // If this is a primary interval header, show the start time // in a tooltip, since there is no text on the header. if ( e.HeaderElement != null && e.HeaderElement.DateTimeInterval.IsPrimaryInterval ) { ToolTipInfo toolTipInfo = e.ToolTipInfo; toolTipInfo.ToolTipText = e.HeaderElement.DateTimeRange.StartDateTime.ToString(TimeInterval.ShortTimePattern); e.ToolTipInfo = toolTipInfo; } } private void OnColumnHeaderInitializing(object sender, ColumnHeaderInitializingEventArgs e) { if ( e.DateTimeInterval.IsPrimaryInterval ) { // Create an image of an analog clock, depicting the // start time for this header, and assign it to the // Image property of the e.AppearanceData TimeSpan time = e.DateTimeRange.StartDateTime.TimeOfDay; Bitmap bmp = ClockImage.GetImage( time, ClockSize, Color.Black, Color.White ); AppearanceData appData = new AppearanceData(); appData.Image = bmp; e.AppearanceData = appData; // Assign a space character to the text, so that // nothing appears, but a tooltip can still be displayed e.Text = " "; } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2