I can set margins individually in code but how do I do it in XAML, e.g. how do I do this:
PSEUDO-CODE:
<StackPanel Margin.Top="{Binding TopMargin}">
Isn't this what you're looking for?
<StackPanel Margin="0,10,0,0" />
The first value is Left margin, then Top, then Right, and last but not least Bottom.
I'm not sure if you want to bind it to something, but if not, that'll work.