tags:

views:

30

answers:

1

hello, I have a Wpf windows like: ScrollViewer > Grid > Image

image is <Image Margin="20,15,10,20" Grid.Row="1" Stretch="Uniform" Source="Images/logo.png" />

the image I want to take only the visible size of the cell in with it is inside, it works exactly as I want if I remove the ScrollViewer, but if I add it, the image takes the size it wants and the scrollbar is added...

My intention is to use scrollbars if controls like buttons etc needs it, not the bg image I'm using...

how can exclude it from layout measuring or something that will just ignore the size the image wants and use the size available in the grid's cel?

I don't want to set a fixed size for the image, I want it to take the visible size only... to workaround this I just set a fixed size, but it just doesn't look good..

thanks

+1  A: 

fixed it... with:

        <Rectangle Margin="20,15,10,20" Grid.Row="1" RadiusX="10" RadiusY="10">
            <Rectangle.Fill>
                <ImageBrush Stretch="Uniform">
                    <ImageBrush.ImageSource>
                        <BitmapImage UriSource="Images/logo.png" />
                    </ImageBrush.ImageSource>
                </ImageBrush>
            </Rectangle.Fill>
        </Rectangle>
Bruno