by Miha Markič
8. October 2006 16:13
[DevEx] XtraLayoutControl sets its items default Padding to 5;5;5;5 (left, right, top, bottom) which might not be always desired value and there is no easy way to alter this default setting as per this support center entry.
However, there is a solution that is fairly easy to implement. Just derive a class from XtraLayoutControl and override CreateLayoutItem method as shown in this piece of code:
public class RhLayoutControl: LayoutControl
{
public override BaseLayoutItem CreateLayoutItem(LayoutGroup parent)
{
BaseLayoutItem item = base.CreateLayoutItem(parent);
item.Padding = new Padding(5, 5, 2, 2);
return item;
}
}
Here I set default Padding for an item to (5, 5, 2, 2) but you can set is as you wish. Of course, instead of XtraLayoutControl you would have to use RhLayoutControl to make this trick work.