Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adjust padding in xaml label

How can I make the top and bottom padding smaller in the following label? As I see it, the bounding box in much bigger than it needs to be, but the padding is set to 0, so it cannot be any smaller.

<Label Background="AliceBlue" Content="1800" FontSize="170" FontWeight="Bold" Foreground="Gray" Padding="0" />
like image 324
Bjarne Avatar asked May 06 '09 05:05

Bjarne


2 Answers

You can use Margin.

With margin you can set the amount you want to go left, right, top, bottom

by this I mean Margin="0,0,0,0" that means. you have none what so ever.

it goes by the following: Margin ="left, top, right, bottom

so if I have margin ="2,5,3,5"

it means I have a margin 2 pixels in from the left, 5 pixels in from the top, 3 pixels from the right and 5 pixels up from the bottom.

like image 112
Kevin Avatar answered Sep 26 '22 02:09

Kevin


Having just hit this where a border was around the label I set a negative margin.

<Border BorderBrush="Black" BorderThickness="1">
    <Label Margin="-5" Content="Unable to report/>
</Border>
like image 35
rob Avatar answered Sep 23 '22 02:09

rob