2013-11-27 65 views
0

我創建"Custom Control"我把圖像中"Themes"文件夾,讓我們稱之爲image.jpg,在"Custom Control"Generic.xaml,我寫了這個:圖像位於的UIElement不顯示[WPF]

<Button Width="30" Height="30"> 
    <Image Source="image.jpg" Width="20" Height="20"/> 
</Button> 

我重新編譯項目,當我在其他項目中使用它時,會顯示Button,但圖像不是......我在做什麼錯誤......還將圖像設置爲其屬性中的資源。

回答

1

你應該正確定位你的形象 像這樣的事情

<Button Width="30" Height="30"> 
<Image Source="/WpfApplication1;component/Images/image.jpg" Width="20" Height="20"/> 
</Button> 
+0

非常感謝您! – jovanMeshkov