2011-09-13 42 views
0

我在XAML中設置了一些東西,但出於某種原因,我遇到了問題。我正在嘗試向我的資源中添加一個ObjectDataProvider,但是當我這樣做時,我收到了有關我的資源的警告,說如果資源中沒有關鍵屬性,則不能在資源緩衝區中有多個項目。因此,我添加了一個關鍵的資源,但我的內容控制中的動態資源存在問題。它說它無法解析「DefaultEmptyPane」。然後,我添加了資源的關鍵參考資料,但之後有一些不匹配。在資源中添加ObjectDataProvider的問題

有沒有人在這裏看到這個問題? 下面是XAML:

<Page.Resources> 
    <!--<ObjectDataProvider x:Key="projectList" MethodName=""/>--> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="/Resources/Panes/DefaultEmptyPane.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
     <local:PopulationNameGetNameOnlyConverter x:Key="PopulationNameGetNameOnlyConverter"/> 
     <local:PopulationNameGetNumberOfTestsConverter x:Key="PopulationNameGetNumberOfTestsConverter"/> 
     <local:PopulationNameGetDateConverter x:Key="PopulationNameGetDateConverter"/> 
     <local:NormValidationValueToVisibilityConverter x:Key="NormValidationValueToVisibilityConverter"/> 
     <local:NormrequestCalculatedToVisibilityConverter x:Key="NormrequestCalculatedToVisibilityConverter"/> 
     <local:RemoveUnderscoreConverter x:Key="RemoveUnderscoreConverter"/> 
    </ResourceDictionary> 
</Page.Resources> 

<ContentControl Template="{DynamicResource DefaultEmptyPane}"> 
    <!--Content--> 
</ContentControl> 

回答

1

傑裏,答案就在你的XAML本身。你是否觀察到爲什麼它給出ObjectDataProvider而不是RemoveUnderscoreConverterNormrequestCalculatedToVisibilityConverterPopulationNameGetDateConverter等錯誤。

觀察它們的位置。它們被放置在ResourceDictionary標籤內,但ObjectDataProvider位於其外面。

希望有所幫助。