Im adding CalloutAnnotation annotations to my GantChart in a UltraChart.ChartDrawItem handler. This drives to an infinte loop. This happens, I guess, because adding an annotation raises ChartDrawItem Event too.
Is there a way for UltraChart control to disable events through a EventManager property, or similar, as other controls do?
Private Sub Gantt_ChartDrawItem(ByVal sender As Object, ByVal e As Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs) ... CreateAnnotation(text, row, column)... End Sub
Private Sub Gantt_ChartDrawItem(ByVal sender As Object, ByVal e As Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs)
...
CreateAnnotation(text, row, column)
End Sub
Private Sub CreateAnnotation(ByVal desc As String, ByVal row As Integer, ByVal column As Integer) RemoveHandler Gantt.ChartDrawItem, AddressOf Gantt_ChartDrawItem '''''''''I've tried removing the handler at the beginning of the subroutine and adding it at the end Dim AnotacioDoc As CalloutAnnotation = New CalloutAnnotation AnotacioDoc.Text = desc AnotacioDoc.TextStyle.FontColor = Color.Black AnotacioDoc.TextStyle.Orientation = Infragistics.UltraChart.[Shared].Styles.TextOrientation.Horizontal AnotacioDoc.Location.Type = Infragistics.UltraChart.[Shared].Styles.LocationType.RowColumn AnotacioDoc.Border.Color = Color.Gray AnotacioDoc.Border.CornerRadius = 2 AnotacioDoc.PE.Fill = Color.FromKnownColor(KnownColor.Info) AnotacioDoc.Location.Column = column AnotacioDoc.Location.Row = 0 Gantt.Annotations.Add(AnotacioDoc)AddHandler Gantt.ChartDrawItem, AddressOf Gantt_ChartDrawItem End Sub
RemoveHandler Gantt.ChartDrawItem, AddressOf Gantt_ChartDrawItem '''''''''I've tried removing the handler at the beginning of the subroutine and adding it at the end
AnotacioDoc.Text = desc
AnotacioDoc.TextStyle.FontColor = Color.Black
AnotacioDoc.TextStyle.Orientation = Infragistics.UltraChart.[Shared].Styles.TextOrientation.Horizontal
AnotacioDoc.Location.Type = Infragistics.UltraChart.[Shared].Styles.LocationType.RowColumn
AnotacioDoc.Border.Color = Color.Gray
AnotacioDoc.Border.CornerRadius = 2
AnotacioDoc.PE.Fill = Color.FromKnownColor(KnownColor.Info)
AnotacioDoc.Location.Column = column
AnotacioDoc.Location.Row = 0
Gantt.Annotations.Add(AnotacioDoc)
You can add annotations when you create the chart or in the FillSceneGraph Event. You can’t add new primitives in the ChartDrawItem Event. In ChartDrawItem Event you can edit the settings of the existing primitives.