Version

HasContext(Object,Boolean) Method

Returns true if this element (or any of its ancestors) has this context
Syntax
'Declaration
 
Public Overloads Function HasContext( _
   ByVal context As Object, _
   ByVal checkParentElementContexts As Boolean _
) As Boolean
public bool HasContext( 
   object context,
   bool checkParentElementContexts
)

Parameters

context
context of object
checkParentElementContexts
If true will walk up the parent chain looking for the context.

Return Value

True if this element (or any of its ancestors) has this context, False otherwise.
Example
This sample uses the HasContext method of UIElement to determine if a given point is over the ActiveRow in an UltraGrid.

Imports System.Windows.Forms
Imports Infragistics.Win
Imports System.Diagnostics

Private Sub UltraGrid1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles UltraGrid1.MouseMove

    If IsPointOverUltraGridActiveRow(New Point(e.X, e.Y)) Then
        Debug.WriteLine("Over Active Row")
    Else
        Debug.WriteLine("Not Over Active Row")
    End If

End Sub



Private Function IsPointOverUltraGridActiveRow(ByVal pt As Point) As Boolean

    Dim hitElement As UIElement = Me.UltraGrid1.DisplayLayout.UIElement.ElementFromPoint(pt)

    If hitElement.HasContext(Me.UltraGrid1.DisplayLayout.ActiveRow) Then
        Return True
    Else
        Return False
    End If

End Function
using System.Windows.Forms
using Infragistics.Win
using System.Diagnostics

private void ultraGrid1_MouseMove(object sender, MouseEventArgs e)
{

	if(IsPointOverUltraGridActiveRow(new Point(e.X,e.Y)))
		Debug.WriteLine("Over Active Row");
	else
		Debug.WriteLine("Not Over Active Row");

}

private bool IsPointOverUltraGridActiveRow(Point pt)
{

	UIElement hitElement = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(pt);

	if(hitElement.HasContext(this.ultraGrid1.DisplayLayout.ActiveRow))
		return true;
	else
		return false;

}
Requirements

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

See Also