views:

18

answers:

1

Hi guys,

The following code

    <StackPanel Orientation="Horizontal">
        <Image Source="test.jpg"/>
        <Image Source="test2.jpg"/>
        <TextBlock Text="TeStBlock"/>
    </StackPanel>

If I am setting the visibility of the contents of the StackPanel in the codebehind and lets say I set the visibility of the Second image to collapsed. I notice that the TextBlock moves to where the Image used to be.

How can I keep the alignment and turn the visibility on or off?

+2  A: 

Use Opacity="0" instead.

AnthonyWJones