'Declaration Public ReadOnly Property UIElement As UltraMonthViewMultiUIElement
public UltraMonthViewMultiUIElement UIElement {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.MonthViewMulti Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim info As String = "The descendant elements of the control's main UIElement are: " + vbCrLf + vbCrLf Me.EnumerateChildElements(Me.ultraMonthViewMulti1.UIElement, info) ' Output the UIElement hierarchy to the debugger System.Diagnostics.Debug.WriteLine(info) End Sub Private Sub EnumerateChildElements(ByVal element As UIElement, ByRef info As String) '---------------------------------------------------------------------------------------------------- ' UIElement ' ' Enumerates the specified UIElement's child elements to display ' the element hierarchy '---------------------------------------------------------------------------------------------------- ' Get the level of the UIElement, so we know how much to indent Dim level As Integer = Me.GetElementLevel(element) ' Append tab characters, the number of which is ' proportional to the element's level in the hierarchy Dim tabChar As String = String.Empty Dim i As Integer For i = 0 To level tabChar += Chr(9) Next ' Increment the level for the next iteration, if any level += 1 ' Iterate the specified element's ChildElements collection, Dim child As UIElement For Each child In element.ChildElements ' Output each child element's type name info += tabChar + child.ToString() + vbCrLf ' Call this function recursively to get each child's children, etc. Me.EnumerateChildElements(child, info) Next End Sub ' Returns the "generation" of the specified UIElement; that is, the ' number of ancestor UIElements it has Private Function GetElementLevel(ByVal element As UIElement) Dim level As Integer Dim parentElement As UIElement = element.Parent ' Increment 'level' until we hit a null parent While Not parentElement Is Nothing level += 1 parentElement = parentElement.Parent End While Return level End Function
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.MonthViewMulti; private void button1_Click(object sender, System.EventArgs e) { string info = "The descendant elements of the control's main UIElement are: " + "\n" + "\n"; this.EnumerateChildElements( this.ultraMonthViewMulti1.UIElement, ref info ); // Output the UIElement hierarchy to the debugger System.Diagnostics.Debug.WriteLine( info ); } private void EnumerateChildElements( UIElement element, ref string info ) { //---------------------------------------------------------------------------------------------------- // UIElement // // Enumerates the specified UIElement's child elements to display // the element hierarchy //---------------------------------------------------------------------------------------------------- // Get the level of the UIElement, so we know how much to indent int level = this.GetElementLevel( element ); // Append tab characters, the number of which is // proportional to the element's level in the hierarchy string tabChar = string.Empty; for ( int i = 0; i <= level; i ++ ) { tabChar += ((char)(9)).ToString(); } // Increment the level for the next iteration, if any level++; // Iterate the specified element's ChildElements collection, foreach( UIElement child in element.ChildElements ) { // Output each child element's type name info += tabChar + child.ToString() + "\n"; // Call this function recursively to get each child's children, etc. this.EnumerateChildElements( child, ref info ); } } // Returns the "generation" of the specified UIElement; that is, the // number of ancestor UIElements it has private int GetElementLevel( UIElement element ) { int level = 0; UIElement parentElement = element.Parent; // Increment 'level' until we hit a null parent while ( parentElement != null ) { level ++; parentElement = parentElement.Parent; } return level; }
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