'Declaration Public ReadOnly Property UIElement As ActionButtonUIElement
public ActionButtonUIElement UIElement {get;}
Imports System Imports System.Drawing Imports System.IO Imports System.Collections.Generic Imports System.ComponentModel Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Misc Imports Infragistics.Win.Misc.UltraWinNavigationBar Private Function NavigationBarLocationFromPoint(ByVal navigationBar As UltraNavigationBar, ByVal point As Point) As UltraNavigationBarLocation ' Throw an exception if the caller specified a null control reference. If navigationBar Is Nothing Then Throw New ArgumentNullException("navigationBar") ' Get the control's UIElement. Dim controlElement As UIElement = navigationBar.UIElement ' Get the lowest-level UIElement at the specified point Dim locationElement As LocationUIElement = Nothing Dim elementAtPoint As UIElement = controlElement.ElementFromPoint(point) While (Not elementAtPoint Is Nothing) If elementAtPoint.GetType() Is GetType(LocationUIElement) Then locationElement = elementAtPoint Exit While End If elementAtPoint = elementAtPoint.Parent End While Return locationElement.Location End Function Private Function GetBounds(ByVal location As UltraNavigationBarLocation, ByVal screen As Boolean) As Rectangle ' Throw an exception if the caller specified a null location. If location Is Nothing Then Throw New ArgumentNullException("location") ' Return an empty rectangle if the Visible or VisibleResolved property ' is set to false. Note that we check Visible first because VisibleResolved ' must walk up the location's ancestor chain, which could potentially be ' expensive. If location.Visible = False Or location.VisibleResolved = False Then Return Rectangle.Empty ' Get the location's UIElement, and its bounds Dim locationElement As UIElement = location.UIElement Dim retVal As Rectangle = Rectangle.Empty If Not locationElement Is Nothing Then retVal = locationElement.Rect ' If the caller specified that we should convert to screen coordinates, convert If screen AndAlso retVal.IsEmpty = False Then Dim navigationBar As UltraNavigationBar = location.NavigationBar If Not navigationBar Is Nothing Then retVal = navigationBar.RectangleToScreen(retVal) Else retVal = Rectangle.Empty End If Return retVal End Function Private Function NavigationBarActionButtonFromPoint(ByVal navigationBar As UltraNavigationBar, ByVal point As Point) As UltraNavigationBarActionButton ' Throw an exception if the caller specified a null control reference. If navigationBar Is Nothing Then Throw New ArgumentNullException("navigationBar") ' Get the control's UIElement. Dim controlElement As UIElement = navigationBar.UIElement ' Get the lowest-level UIElement at the specified point Dim actionButtonElement As ActionButtonUIElement = Nothing Dim elementAtPoint As UIElement = controlElement.ElementFromPoint(point) While (Not elementAtPoint Is Nothing) If elementAtPoint.GetType() Is GetType(ActionButtonUIElement) Then actionButtonElement = elementAtPoint Exit While End If elementAtPoint = elementAtPoint.Parent End While Return actionButtonElement.ActionButton End Function Private Function GetBounds(ByVal actionButton As UltraNavigationBarActionButton, ByVal screen As Boolean) As Rectangle ' Throw an exception if the caller specified a null actionButton. If actionButton Is Nothing Then Throw New ArgumentNullException("actionButton") ' Return an empty rectangle if the Visible property is set to false. If actionButton.Visible = False Then Return Rectangle.Empty ' Get the actionButton's UIElement, and its bounds Dim actionButtonElement As UIElement = actionButton.UIElement Dim retVal As Rectangle = Rectangle.Empty If Not actionButtonElement Is Nothing Then retVal = actionButtonElement.Rect ' If the caller specified that we should convert to screen coordinates, convert If screen AndAlso retVal.IsEmpty = False Then Dim navigationBar As UltraNavigationBar = actionButton.NavigationBar If Not navigationBar Is Nothing Then retVal = navigationBar.RectangleToScreen(retVal) Else retVal = Rectangle.Empty End If Return retVal End Function
using System; using System.Drawing; using System.IO; using System.Collections.Generic; using System.ComponentModel; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Misc; using Infragistics.Win.Misc.UltraWinNavigationBar; // Returns the UltraNavigationBarLocation instance at the specified point // (expressed in client coordinates), or null if none is found. private UltraNavigationBarLocation NavigationBarLocationFromPoint( UltraNavigationBar navigationBar, Point point ) { // Throw an exception if the caller specified a null control reference. if ( navigationBar == null ) throw new ArgumentNullException("navigationBar"); // Get the control's UIElement. UIElement controlElement = navigationBar.UIElement; // Get the lowest-level UIElement at the specified point LocationUIElement locationElement = null; UIElement elementAtPoint = controlElement.ElementFromPoint( point ); while ( elementAtPoint != null ) { locationElement = elementAtPoint as LocationUIElement; if ( locationElement != null ) break; elementAtPoint = elementAtPoint.Parent; } return locationElement.Location; } // Returns the bounds of the specified UltraNavigationBarLocation instance, // optionally expressed in screen coordinates, or Rectangle.Empty if the // specified location is currently off screen. private Rectangle GetBounds( UltraNavigationBarLocation location, bool screen ) { // Throw an exception if the caller specified a null location. if ( location == null ) throw new ArgumentNullException("location"); // Return an empty rectangle if the Visible or VisibleResolved property // is set to false. Note that we check Visible first because VisibleResolved // must walk up the location's ancestor chain, which could potentially be // expensive. if ( location.Visible == false || location.VisibleResolved == false ) return Rectangle.Empty; // Get the location's UIElement, and its bounds UIElement locationElement = location.UIElement; Rectangle retVal = locationElement != null ? locationElement.Rect : Rectangle.Empty; // If the caller specified that we should convert to screen coordinates, convert if ( screen && retVal.IsEmpty == false ) { UltraNavigationBar navigationBar = location.NavigationBar; retVal = navigationBar != null ? navigationBar.RectangleToScreen(retVal) : Rectangle.Empty; } return retVal; } // Returns the UltraNavigationBarActionButton instance at the specified point // (expressed in client coordinates), or null if none is found. private UltraNavigationBarActionButton NavigationBarActionButtonFromPoint( UltraNavigationBar navigationBar, Point point ) { // Throw an exception if the caller specified a null control reference. if ( navigationBar == null ) throw new ArgumentNullException("navigationBar"); // Get the control's UIElement. UIElement controlElement = navigationBar.UIElement; // Get the lowest-level UIElement at the specified point ActionButtonUIElement actionButtonElement = null; UIElement elementAtPoint = controlElement.ElementFromPoint( point ); while ( elementAtPoint != null ) { actionButtonElement = elementAtPoint as ActionButtonUIElement; if ( actionButtonElement != null ) break; elementAtPoint = elementAtPoint.Parent; } return actionButtonElement.ActionButton; } // Returns the bounds of the specified UltraNavigationBarActionButton instance, // optionally expressed in screen coordinates, or Rectangle.Empty if the // specified actionButton is currently off screen. private Rectangle GetBounds( UltraNavigationBarActionButton actionButton, bool screen ) { // Throw an exception if the caller specified a null actionButton. if ( actionButton == null ) throw new ArgumentNullException("actionButton"); // Return an empty rectangle if the Visible property is set to false. if ( actionButton.Visible == false ) return Rectangle.Empty; // Get the actionButton's UIElement, and its bounds UIElement actionButtonElement = actionButton.UIElement; Rectangle retVal = actionButtonElement != null ? actionButtonElement.Rect : Rectangle.Empty; // If the caller specified that we should convert to screen coordinates, convert if ( screen && retVal.IsEmpty == false ) { UltraNavigationBar navigationBar = actionButton.NavigationBar; retVal = navigationBar != null ? navigationBar.RectangleToScreen(retVal) : Rectangle.Empty; } return retVal; }
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