I'm trying to detect when the mouse enters any of my ultragrid's column headers. I have code which works successfully for the mouse entering a cell in my MouseEnterElement handler:
void Grid_MouseEnterElement(object sender, UIElementEventArgs e){ CellUIElement cell = e.Element.GetAncestor(typeof(CellUIElement)) as CellUIElement;
....
}
Presumably there is similar code for the column header.. but I'm struggling to get it to work
You probably just need to check for a HeaderUIElement insead of a CellUIElement.
I recommend getting the Infragistics UIElementViewer Utility. It will be a big help in understanding and identifying UIElement.
Also, the code you have here may not work in all cases. You are calling GetAncestor on e.Element. So this will work if the element the mouse entered is a child of a CellUIElement, but you are not accounting for when the e.Element is actually a CellUIElement itself. This is probably okay for a Cell, since CellUIElements always contain child elements that completely cover them. But it's something to be aware of for other elements.