WPF Image stretch to fill doesn't stretch to the bounds of it's parents

前端 未结 2 1835
眼角桃花
眼角桃花 2020-12-11 05:58

Here\'s my XAML and how it looks like:



        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 06:28

    The problem is that you have the images within a canvas. Basically, any time you put an element in a Canvas panel, you are disregarding the entire layout system. Elements within a canvas do not participate in layout at all. What you want to do is replace the Canvas element with a plain Grid element (you don't need to define rows or columns, it will default to a single row/column.)

    EDIT

    And actually looking more closely at what you are trying to do, you'll need to make some slight tweaks. Try this.

    
        
            
            
                                   
    
    

提交回复
热议问题