Hi,
I'm displaying a column of buttons in an UltraWinGrid using ColumnStyle.Button and ButtonDisplayStyleAlways.
The button is sized to fill the entire cell and I need to have a margin of whitespace around the button so that it's slightly shorter than the row height and slightly narrower than the column width. I can get roughly the appearance I need by using ' this.ultraGrid1.DisplayLayout.Override.CellSpacing = 5; ', but that affects all cells. Is there a way to only adjust the CellSpacing for the column with the button in it? Alternatively is there a way to add a margin around the button? The ideal would be that the button has a top, left & right margin, but no bottom margin so that the bottom of the button is level with the bottom of the row.
Thanks
Andy
Andy,
I don't think that there is any property that is more specific than the band-level CellSpacing (which is resolved from the override), but you could certainly accomplish this with a creation filter:
private class CF : IUIElementCreationFilter{ #region IUIElementCreationFilter Members public void AfterCreateChildElements(UIElement parent) { CellUIElement cellElement = parent as CellUIElement; if (cellElement != null && cellElement.Column.Key == "Button") { CellButtonUIElement buttonElement = cellElement.GetDescendant(typeof(CellButtonUIElement)) as CellButtonUIElement; if (buttonElement != null) { Rectangle originalRect = buttonElement.Rect; buttonElement.Rect = new Rectangle( new Point(originalRect.Location.X + 2, originalRect.Location.Y + 2), new Size(originalRect.Size.Width - 4, originalRect.Size.Height - 2)); } } } public bool BeforeCreateChildElements(UIElement parent) { return false; } #endregion}
this.ultraGrid1.CreationFilter = new CF();
-Matt