Hello Everyone,
I have a nice looking UltraGrid with a few columns of buttons. But the buttons like pretty bad because there is no padding between them.
Can I add cell padding / spacing between columns / rows or individual cells??
Thanks,
Yes. Check out the CellPadding and / or CellSpacing property on the grid.DisplayLayout.Override.
Thanks for the reply. That solution is close to what I need but it makes all of the other columns in the UltaGrid have the identical cell padding or cell spacing which looks pretty bad...
This is the code I'm using - it adds some nasty gray space between the text content and the cell wall of all the other cells - I'm trying to eliminate that gray space with the else condition - I tried values of -1, 0 and 1 and all are ignored.
//HOW TO MAKE THE BUTTONS NOT FLUSH WITH THE CELL WALLS???
{
ultraGridColumn.Layout.Override.CellSpacing = 4;
}
else
ultraGridColumn.Layout.Override.CellSpacing = -1;
Hi,
There's no property setting to allow you to apply padding to a single cell or column. I suppose you might be able achieve what you want using a CreationFilter.
What kind of button are you referring to here? Are you setting the Style of a column to Button and you want padding around the button? Or is this a dropdown button or an EditButton or an EditorButton?
I'm setting style of a column to Button.
Hi Eugene,
I'm confused. I tried this out and I set CellPadding on the override to 5 in a grid with a button column. But the padding has no effect on the button column. The button still fills the entire cell.
So what's the problem you are trying to solve?
Hi Mike,
The problem I'm trying to solve is to make button in column to not filling all the entire cell but at the same time all other column's content should fill all the cell.
Is it possible?
Oh, so you are doing the opposite of what the original poster in this thread asked. Okay... that's pretty easy to do with a CreationFilter.
private void Form1_Load(object sender, System.EventArgs e) { this.ultraGrid1.CreationFilter = new ButtonCreationFilter(); }
public class ButtonCreationFilter : IUIElementCreationFilter { void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { if (parent is CellUIElement) { UIElement cellButtonUIElement = parent.GetDescendant(typeof(CellButtonUIElement)); if (null != cellButtonUIElement) { Rectangle rect = parent.RectInsideBorders; rect.Inflate(-3, -3); cellButtonUIElement.Rect = rect; } } } bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { // do nothing return false; } }
Thank yo so much, Mike. It works fine.