How do I make an image stretch to fill in this WPF / XAML application?

后端 未结 4 1093
慢半拍i
慢半拍i 2021-01-05 18:24

When my program displays an image which is smaller than the Image GUI object defined in XAML, it does not get stretched to fit as I would like it to. For example a 256x256

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 18:53

    Instead of Image use Image Brush that will do the work for you

     
                
     
    

    And in the Code Behind you can Set

       image.ImageSource = bmpsrc; // if you can give the URL of the File Located on the Disk
    

提交回复
热议问题