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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM