2012-03-02 51 views
0

我做了一個Silverlight項目是這樣的:Silverlight和ASP網頁

<UserControl x:Class="silverlighttest3.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" Height="270" Width="487"> 

<Grid x:Name="LayoutRoot" Background="blue" Height="270" Width="487" HorizontalAlignment="Stretch"> 
    <MultiScaleImage HorizontalAlignment="Left" Margin="146,27,0,0" Name="multiScaleImage1" VerticalAlignment="Top" Source="Source/dzc_output.xml"/> 
</Grid> 

之後,我測試了它和它的工作就好了。

問題是測試承載Silverlight項目的Web應用程序時,嘗試'testsilverlight.aspx'時沒有任何顯示。

注意:源文件夾位於Silverlight目錄中,而不在Web應用程序目錄中。當將其複製到Web應用程序目錄時,結果是相同的 - 白頁。

回答

0

我找到了一個鏈接,可以幫助你:Source attribute of Silverlight MultiScaleImage

而且,我不知道你的項目結構是如何設置的,但要確保你的xml文件的生成操作設置爲內容和其在構建在相同的相對文件夾結構中後,它將包含在您的xap文件中。

+0

[MSDN Page](http://msdn.microsoft.com/en-us/library/system.windows.controls.multiscaleimage(v = vs.95).aspx)上的代碼表示正斜槓在開始時是不需要的。此外,如果只是這樣,就會看到一個藍色邊框 - 網格的背景被設置。 – ChrisF 2012-03-03 22:34:47

+0

正確,但取決於您的項目設置方式以及您打算從uri的格式引用內容文件的位置確實很重要,以下鏈接提供了有關此主題的一些較好信息:http://forums.silverlight。淨/ p/160173/364401.aspx。無論如何,當我的Silverlight應用沒有反映預期的行爲時,我想到了之前遇到的另一個痛點,請參閱上面的編輯。 – KodeKreachor 2012-03-03 23:06:10