user2740190
user2740190

Reputation:

Image in one column is expanding to the second column

I have defined a grid with some rows and two columns In [0,0] I have placed an image with main attributes as below:

 HorizontalAlignment="Left" VerticalAlignment="Center" 
 Stretch="None" Margin="10 0 0 0" Width="260"

And in [0,1] I have placed a label with some text in it with some main attributes like this:

 HorizontalContentAlignment="Left" HorizontalAlignment="Left" Width="36" FontSize="16"

My question is why if I remove the width = 260 from image field then suddenly also the label in next column is disappearing? I think the image expands and covers it. But why? Shouldn't it be limited to its own [0,0] cell?

Upvotes: 0

Views: 33

Answers (1)

Mashton
Mashton

Reputation: 6415

Your columns are autosizing to the size of their contents, so I would guess that your image in (0,0) isn't actually spreading into column 1 it is just that column 0 is growing so large that you can't see column 1 anymore.

If you make the column size * you will constrain it to the available space. As someone else said, you can use ShowGridLines to help debug what is going on with your columns, especially if you add a second row just to see where the division between your columns is.

Upvotes: 1

Related Questions