[英]Get Source URI of Image from code behind
我有一個聲明的Image
並在XAML中使用以下代碼指定了Source
-
<Image x:Name="imgSomeFile" Source="Assets/someFile.png"/>
有沒有一種方法可以僅使用實例名稱在后面的代碼中訪問此源URI? 我已經嘗試過image.Source
但這只提供了該圖像使用的BitmapImage
而不是URI。
使用從源代碼獲取的BitmapImage
的UriSource
屬性。
((imgSomeFile).Source as BitmapImage).UriSource.OriginalString
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.