Blend Bits 3: Watch Your Margins

If I’m working on this layout with a simple grid;

image

and I add a Button to that top left (0,0) grid cell by selecting the button control over on my “Tools” window and then drawing a Button within the grid cell or by just double-clicking in the grid cell then I get a Button;

image

but I also get something that I hadn’t bargained for. Margins.

I’m not sure whether there’s a super-smart way around this but I often find in Blend that I’m checking the Layout area of the Properties panel to see whether I’ve ended up with some Margin or some Alignment that I wasn’t expecting and, in this particular case I see;

image

This was a reasonable thing for Blend to do but I didn’t actually want it. I wanted my Button to fill the available space within its Grid cell. What to do? I can either manually set all those Left,Top,Right,Bottom values to 0 or I can use the right mouse menu;

image

and that’ll get Blend to zero all those margins for me.

Watch your margins Smile As an aside, Visual Studio has a similar right mouse menu for resetting margins and alignment.