ChartDirector 6.2 (.NET Edition)



[C#] public bool IsInViewPortChangedEvent {get;};
[VB] Public ReadOnly Property IsInViewPortChangedEvent As Boolean


Checks if the current code is executing in a ViewPortChanged event.

This is to help preventing "event looping" in complicated GUI designs in which multiple controls can update the viewport and indirectly update each others.

For example, suppose in a scrollable chart design, the x-axis can be scrolled by both a scroll bar control and a date/time picker control. That means both scroll bar and date/time picker events may update the viewport.

The following sequence of events may happen:

The above is potentially an infinite loop as the ViewPortChanged event will keep firing again and again. To avoid this, WinChartViewer.updateViewPort will perform no action if it is called within ViewPortChanged event. So the last step above cannot actually trigger another ViewPortChanged event. This avoids the infinite loop.

Internally, WinChartViewer.updateViewPort use this property to checks if it is called within a ViewPortChanged event, and ignores the request if it is already in the event. This property allows external code to also change behaviour in a ViewPortChanged event.