user496949
user496949

Reputation: 86165

How to leave margin between elements in the stack panel

I use the stack panel. It looks like every elements inside is stacking tightly. How to leave some margin between them.

Upvotes: 0

Views: 612

Answers (2)

Kishore Kumar
Kishore Kumar

Reputation: 21873

<StackPanel Grid.Row="1" Orientation="Horizontal">
            <Rectangle Fill="White" Stroke="Black" Width="100" Height="35" StrokeThickness="5" Margin="5,0,0,0"/>
            <Rectangle Fill="White" Stroke="Black" StrokeThickness="5" Width="100" Height="35" Margin="5,0,0,0"/>
            <Rectangle Fill="White" Stroke="Black" Width="100" Height="35" Margin="5,0,0,0" StrokeThickness="5"/>
        </StackPanel>

Upvotes: 1

Notter
Notter

Reputation: 588

Easiest way is to give each item it's own Margin

Upvotes: 3

Related Questions