Default Padding for XtraLayoutControl items

[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.

2 thoughts on “Default Padding for XtraLayoutControl items

  1. Thnigs are going pretty smooth for you, I see, apart from the circus with VS2005SP1 and 3rd Party Toolbox.
    Hope to see you soon in Zagreb, to share a few of your tricks. We got Dejan Sarka this month (see URL), you are the next one πŸ™‚
    P.S.
    Hope you didn’t spend a fortune on GPRS roaming this year, checking your mail

  2. Hej Vatroslav,

    Fortunatelly I don’t travel much lately πŸ™‚ so I don’t bother with GPRS roaming (which is crazy expensive).
    Dejan is a very entertaining speaker, I am sure he will do a great presentation.
    Hehe, I am the next one πŸ˜›

Leave a Reply