-1
private void button1_Click(object sender, RoutedEventArgs e)
{
MyImage.Source = new BitmapImage(new Uri("../Image/" + txtImage.Text,
UriKind.Relative));
}
爲什麼圖像不顯示?Silverlight中的顯示圖像4
private void button1_Click(object sender, RoutedEventArgs e)
{
MyImage.Source = new BitmapImage(new Uri("../Image/" + txtImage.Text,
UriKind.Relative));
}
爲什麼圖像不顯示?Silverlight中的顯示圖像4
你的相對URI不能包含,特別是以"../"
開頭。
除非它以"/"
開頭,或者以"http://"
開頭的絕對URL,否則假定它位於模塊中。
像"/images/imagename.jpg"
這樣的URL將找到位於託管網站上的clientbin/images
文件夾中的圖像。
另請參閱我的回答,瞭解更多信息:Binding image in Isolated Storage
問題在哪裏? –
歡迎來到Stack Overflow。爲了得到這個問題的答案,我們需要更多的信息和上下文。究竟發生了什麼問題? – ChrisF
+1:我已經添加了他們可能要問的問題。 Silverlight中的URL有幾處需要人們注意的地方。出於這個原因,我加回了一票,因爲-2是有點苛刻的:) –