Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDock
Private Sub LogDockInfoFromPoint(ByVal pt As Point)
' Use the UltraDockManager's ElementFromPoint to access
' the dock manager UIElement at the specified screen coordinate
Dim element As UIElement = Me.ultraDockManager1.ElementFromPoint(pt)
' Log the information to the debug window
Debug.WriteLine(New String("=", 50))
Debug.WriteLine(String.Format("Dock Information From Point:", pt))
Debug.Indent()
Debug.WriteLine("UIElement Info:")
Debug.Indent()
If element Is Nothing Then
Debug.WriteLine("null")
Else
Me.OutputElementInfo(element)
End If
Debug.Unindent()
' The 'PaneFromPosition' method accepts screen coordinates
' and a boolean indicating whether to ignore the floating
' windows.
' Passing in true for the 'ignoreFloatingWindows' argument
' will only check the docked panes on the host control
Dim dockedPane As DockablePaneBase = Me.ultraDockManager1.PaneFromPosition(pt, True)
' Passing in false will include the floating windows when
' checking the coordinate
Dim anyPane As DockablePaneBase = Me.ultraDockManager1.PaneFromPosition(pt, False)
Debug.WriteLine("Pane From Position (Ignoring Floating Windows):")
Debug.Indent()
If dockedPane Is Nothing Then
Debug.WriteLine("null")
Else
Me.OutputPaneInfo(dockedPane)
End If
Debug.Unindent()
Debug.WriteLine("Pane From Position (Including Floating Windows):")
Debug.Indent()
If dockedPane Is anyPane Then
Debug.WriteLine("Same as ignoring floating windows")
ElseIf anyPane Is Nothing Then
Debug.WriteLine("null")
Else
' The only time this will be is if we are over a floating
' window that is positioned over another docked pane
Me.OutputPaneInfo(anyPane)
End If
Debug.Unindent()
Debug.Unindent()
Debug.WriteLine(New String("=", 50))
End Sub
Private Sub OutputPaneInfo(ByVal pane As DockablePaneBase)
' The ToString method of the pane includes information
' about the pane including
Debug.Write(pane.ToString())
If (pane.IsActive) Then
Debug.Write(", [Active Pane]")
End If
If (pane.IsSelectedTab) Then
Debug.Write(", [Selected Tab]")
End If
If (pane.MaximizedResolved) Then
Debug.Write(", [Maximized]")
ElseIf (pane.MinimizedResolved) Then
Debug.Write(", [Minimized]")
End If
Debug.WriteLine(String.Empty)
' Walk up the parent change
If Not pane.Parent Is Nothing Then
Debug.Indent()
Me.OutputPaneInfo(pane.Parent)
Debug.Unindent()
End If
End Sub
Private Sub OutputElementInfo(ByVal element As UIElement)
Debug.Write(element.ToString())
' Get the default context for the element
Dim defaultContext As Object = element.GetContext(Nothing, False)
If Not defaultContext Is Nothing Then
Debug.Write(String.Format(", Context = '{0}'", defaultContext))
End If
Debug.WriteLine(String.Empty)
If Not element.Parent Is Nothing Then
Debug.Indent()
Me.OutputElementInfo(element.Parent)
Debug.Unindent()
End If
End Sub