I have added drawfilter to hide the cells of a particular column in ultragrid by setting the border style to none and removed the borders of the cell. But the border is still visible. Don't know what I am missing.
class MyDrawFilter : IUIElementDrawFilter
{
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams)
{
if (drawParams.Element is CellUIElement)
{
UltraGridCell myCell = drawParams.Element.GetContext(typeof(UltraGridCell)) as UltraGridCell;
if (myCell.Column.Key == "col1")
{
return Infragistics.Win.DrawPhase.BeforeDrawBorders;
}
return DrawPhase.None;
}
return DrawPhase.None;
}
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
{
Border3DSide border = drawParams.Element.BorderSides;
border &= ~Border3DSide.Middle;
border &= ~Border3DSide.Right;
drawParams.DrawBorders(UIElementBorderStyle.None, border);
return true;
}
}
The custom
DrawFilterbelow draw border for all cells in aUltraGridexcept defined column:The trick here is using
DrawPhase.AfterDrawElementfor drawing the row borders.When filter defined above applied the
UltraGridfrom some Infragistics example the control look like on the screen-shot below (filtered column marked in red):