1

Using C#, how to set the Background image's TileMode and Stretch property?

StackPanel1.Background = new ImageBrush(new ....); // OK
StackPanel1.Background = Stretch.Uniform; //this doesn't work...

skaffman
  • 398,947
  • 96
  • 818
  • 769
KMC
  • 19,548
  • 58
  • 164
  • 253

1 Answers1

2

Need to set the property on the image brush itself.

var imageBrush = new ImageBrush();
imageBrush.Stretch = Stretch.Uniform;
StackPanel1.Background = imageBrush;
Spruce
  • 282
  • 3
  • 13