wpf让图片自适应容器大小,而且又不会拉升变形

 1         <Grid Grid.Column="3"
 2               Margin="0,4,0,0"
 3               Background="Black">
 4             <Viewbox>
 5                 <Image Width="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelWidth}"
 6                        Height="{Binding RelativeSource={RelativeSource Self}, Path=Source.PixelHeight}"
 7                        Source="{Binding CtrlImage, IsAsync=True}"
 8                        Stretch="None" />
 9             </Viewbox>
10         </Grid>

 

posted on 2018-10-31 17:44  Shine-Zhong  阅读(6274)  评论(0)    收藏  举报

导航