0

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 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.