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