Question

I'm starting in WPF and I'm developing an application that has a background (.png) applied as follow:

'<Border.Background>'
'<ImageBrush ImageSource="final.png" AlignmentY="Top"/>'
'</Border.Background>'

No problems until here. My problem is because I have an Expander in my window and, in my collapsed method I make an alteration in window size, as shown:

private void Expander_Collapsed(object sender, RoutedEventArgs e)
{
windowFrame.Height = 400;
}

I would like that image, used as background, stay fixed after expander action, ie, when the window is expanded the background is shown full, and when is Collapsed the background shall be cutted.

In analogy to c#, is similar like BackgroundImageLayout = none. You can redim your WindowsForm and the image will be showing according to windows size.

I need finish this job and I hope find my answer here.

Thanks a lot!

Was it helpful?

Solution

<ImageBrush ImageSource="final.png" AlignmentY="Top" Stretch="None"/>

The default value for Stretch is "Fill"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top