Need a little direction please...
I have been asked to draw a cell as black on black (redact the cell) unless on a specific row type. Now if the cell was plain text... its a piece of cake; however, the column is a T/F value and gets a checkbox editor control. No matter what I do to the ForeColor and BackColor or Enable/Disable, the edit control remains "visible." Make matters worse, I have not found how I might get at the edit control's Visible property.
Any idea how I might effect this desire? Do I create an unbound column and manually add the edit control to the cell or ??? Sure could use a hint or 2 or 3...
Thx,
Brian
Hello,
I have created small creation filter that achieves a black background on the CheckBox column.
class CreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members
public void AfterCreateChildElements(UIElement parent) { CellUIElement objCellUIEl; UltraGridCell objCell; if (parent is CellUIElement) { objCellUIEl = (CellUIElement)parent; objCell = (UltraGridCell)objCellUIEl.GetContext(typeof(UltraGridCell));
//Check if the cell is not null and it is from the correct column if (objCell != null && objCell.Column.Key == "BoolA") { //Set the backColor to the desired cell if (objCell.Row.Index == 5) { //Create and position the new UIElement UIElement uiElColored = new UIElement(objCellUIEl); uiElColored.Rect = new Rectangle(objCellUIEl.Rect.X, objCellUIEl.Rect.Y, objCellUIEl.Rect.Width, objCellUIEl.Rect.Height); objCellUIEl.ChildElements.Add(uiElColored);
objCell.Appearance.BackColor = Color.Black; } }
} }
public bool BeforeCreateChildElements(UIElement parent) { //do nothing return false; }
And you have to apply this creation filter to your UltraGrid like the following:
ultraGrid1.CreationFilter = new CreationFilter();
Please let me know if you have any other questions.
OMG is all I can say.
I was looking far deeper than I should have. My latest attempt was changing CellDisplayStyle and hopefully the cell Activation property to enable/disable the edit control. But quickly learned Activation is not a cell property. Ugh. :-) I know I must have looked at the Hidden property many times; but, kept thinking... no I don't want to hide the cell, I want to make the checkbox in side not visible.
As for color... I suspect Gray and no visible control will be OK with the Product team. Will play with the cell Appearance properties a bit to see if I can reach the black color they desire.
Thx for the re-pointing and pulling the leash back. Sometimes get caught by details and don't see the forest for all the trees.
Hi Brian,
Does it have to be black on black? Or do you just want to hide the checkbox?
If the former, then I'd use a CreationFilter to replace the contents of the cell with a single UIElement and give it a solid background.If you are not familiar with CreationFilters, then this will be a bit tricky for your first one, but I can help you along with some sample code if you need it.
If you just want to hide the checkbox, then this is incredibly easy. All you have to do is use the InitializeRow event and set the Hidden property on the cell based on some other cell values in the same row.