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>

猜你喜欢

转载自www.cnblogs.com/zsx-blog/p/9884599.html
今日推荐