Лучший способ получить UltraColumn под курсором - использовать событие MouseUp класса UltraGrid .
Вот пример на C #, но я уверен, что вы поймете мою идею:
private void Grid_MouseUp(object sender, MouseEventArgs e)
{
UltraGrid Grid = sender as UltraGrid;
if (Grid.DisplayLayout == null)
return;
UIElement ue = Grid.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
if (ue == null)
return;
UIElement mouseupItem = ue;
UltraGridColumn mouseupColumn = null;
UltraGridRow mouseupRow = null;
UltraGridBand mouseupBand = null;
ColumnHeader mouseupColumnHead = null;
mouseupColumn = (UltraGridColumn)ue.GetContext(typeof(UltraGridColumn), true);
mouseupRow = (UltraGridRow)ue.GetContext(typeof(UltraGridRow), true);
mouseupBand = (UltraGridBand)ue.GetContext(typeof(UltraGridBand), true);
mouseupColumnHead = (ColumnHeader)ue.GetContext(typeof(ColumnHeader), true);
if (mouseupColumnHead != null)
mouseupColumn = mouseupColumnHead.Column;
if (e.Button == MouseButtons.Right)
{
ShowPopupMenu( mouseupColumn );
return;
}
}