If you’ve checked your growing requirements you will find that most plants prefer a reasonably well-drained soil, so it’s good to line the bottom of your trough with crocks (broken up terracotta pots or stones) or if you want something lighter, then polystyrene chunks. Adding twiggy material (as in the picture) also helps with drainage and at the same time retaining moisture.
Moisture-retentive, but well-drained?
It seems a bit of a contradiction, but most plants prefer soil that is moisture retentive, but at the same time well-drained - Basically they don't like drying out, but don't want to be sitting in pools of stagnant water either!
You also need to consider that some plants, such as Mint, may be more invasive than others, so it’s good to limit those that are in one way or another. One way is to build a wooden division into the design of your windowbox (As below) . Another way could be to simply slide in a piece of slate of the approximate width and depth – though it will need to fit tightly to stop stray roots or rhizomes from finding any gaps
If on the other hand you want to grow the few edible plants that would naturally grow in damp, boggy conditions (such as cowberry or cranberry (right) then reducing water loss is really important, so instead of using crocks you should line your windowbox with pond liner or an old potting compost bag, which should be punctured with a few small holes.
Creating different conditions in the same windowbox
If you're keen to experiment with crops that have completely different growing requirements then you can always create separate divisions (as you would to control invasiveness), but create different drainage conditions or fill with different types of soil.
Acid or Alkaline?
Bog plants, such as those mentioned above also require very acidic conditions to do well, so you will need to plant them in either peat-reclaimed compost (see Handy Links Page) or you can bury pine needles or wood shavings in your soil to artificially lower the PH (ie make more acidic).
Fortunately most fruit and veg. plants are not as fussy, doing best in a soil that is just very slightly acidic.