2010-10-14 43 views
0

,我發現了以下錯誤:的Silverlight /表達式:XAML生成錯誤

OBJ \調試\ StoryList.g.cs(40,22):錯誤 CS0102:類型 「Newsreader.StoryList ' 已經包含了 定義 '_contentLoaded'

OBJ \調試\ StoryList.g.cs(46,21):錯誤 CS0111:類型 'Newsreader.StoryList' 已經定義了一個稱爲成員 ' 的InitializeComponent '與相同種參數類型

這裏是XAML:

<Grid x:Name="MyLayoutRoot" Background="Transparent"> 
    <ScrollViewer d:LayoutOverrides="Height" HorizontalAlignment="Left" Width="424"> 
     <StackPanel Height="865"> 
      <local:StoryControl Height="206" HorizontalAlignment="Left"> 
       <Custom:Interaction.Triggers> 
        <Custom:EventTrigger EventName="MouseLeftButtonDown"> 
         <ic:NavigateToPageAction TargetPage="/StoryPage.xaml"/> 
        </Custom:EventTrigger> 
       </Custom:Interaction.Triggers> 
      </local:StoryControl> 
      <local:StoryControl Height="206" HorizontalAlignment="Left"> 
       <Custom:Interaction.Triggers> 
        <Custom:EventTrigger EventName="MouseLeftButtonDown"> 
         <ic:NavigateToPageAction TargetPage="/StoryPage.xaml"/> 
        </Custom:EventTrigger> 
       </Custom:Interaction.Triggers> 
      </local:StoryControl> 
      <local:StoryControl Height="206" HorizontalAlignment="Left"> 
       <Custom:Interaction.Triggers> 
        <Custom:EventTrigger EventName="MouseLeftButtonDown"> 
         <ic:NavigateToPageAction TargetPage="/StoryPage.xaml"/> 
        </Custom:EventTrigger> 
       </Custom:Interaction.Triggers> 
      </local:StoryControl> 
      <local:StoryControl Height="206" HorizontalAlignment="Left"/> 
     </StackPanel> 
    </ScrollViewer> 
</Grid> 

我應該怎麼做是錯在這裏幹什麼?我正在複製/粘貼以創建新的控件。這可能與它有關嗎?

回答

0

您是否碰巧在Newsreader.StoryList(例如StoryList.cs)中的其他地方定義了「_contentLoaded」和「InitializeComponent」?

如果您打開StoryList.g.cs並查看生成的代碼,則可能會在此處看到問題。

0

我有這個問題從其他人的代碼複製ResourceDictionary。

在我的情況下,我發現在源ResourceDictionary中有人定義了一個x:Class名稱。編譯器試圖在同一個對象中混合源和複製,因此出現錯誤。