For some panel styles, the information displayed by a panel is calculated or changed based on other values. The DisplayText returns the text that is currently displayed by the panel taking all formatting into account.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinStatusBar Imports System.Diagnostics Private Sub ultraStatusBar1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraStatusBar1.Click Dim mainElement As UIElement Dim element As UIElement Dim screenPoint As Point Dim clientPoint As Point Dim panel As UltraStatusPanel ' Get the control's main element mainElement = Me.ultraStatusBar1.UIElement ' Convert the current mouse position to a point ' in client coordinates of the control. screenPoint = Control.MousePosition clientPoint = Me.ultraStatusBar1.PointToClient(screenPoint) ' Get the element at that point element = mainElement.ElementFromPoint(clientPoint) If element Is Nothing Then Return Debug.WriteLine("Clicked on an " + element.GetType().ToString()) Debug.Indent() ' Get the row that contains this element. panel = element.GetContext(GetType(UltraStatusPanel)) If Not panel Is Nothing Then Debug.WriteLine("panel style: " + panel.Style.ToString()) Debug.WriteLine("key: " + panel.Key) Debug.WriteLine("index: " + panel.Index.ToString()) Debug.WriteLine("text: " + panel.DisplayText) End If ' Walk up the parent element chain and write out a line ' for each parent element. While Not element.Parent Is Nothing element = element.Parent Debug.WriteLine("is a child of an " + element.GetType().ToString()) Debug.Indent() End While ' reset the indent level Debug.IndentLevel = 0 End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinStatusBar; private void ultraStatusBar1_Click(object sender, System.EventArgs e) { UIElement mainElement; UIElement element; Point screenPoint; Point clientPoint; UltraStatusPanel panel; // Get the control's main element mainElement = this.ultraStatusBar1.UIElement; // Convert the current mouse position to a point // in client coordinates of the control. screenPoint = Control.MousePosition; clientPoint = this.ultraStatusBar1.PointToClient( screenPoint ); // Get the element at that point element = mainElement.ElementFromPoint( clientPoint ); if ( element == null ) return; Debug.WriteLine( "Clicked on an " + element.GetType().ToString() ); Debug.Indent(); // Get the row that contains this element. panel = element.GetContext( typeof( UltraStatusPanel ) ) as UltraStatusPanel; if ( panel != null ) { Debug.WriteLine( "panel style: " + panel.Style.ToString() ); Debug.WriteLine( "key: " + panel.Key ); Debug.WriteLine( "index: " + panel.Index.ToString() ); Debug.WriteLine( "text: " + panel.DisplayText ); } // Walk up the parent element chain and write out a line // for each parent element. while (element.Parent != null ) { element = element.Parent; Debug.WriteLine("is a child of an " + element.GetType().ToString()); Debug.Indent(); } // reset the indent level Debug.IndentLevel = 0; }
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