开发者

Problems adding an ObjectDataProvider in resources

开发者 https://www.devze.com 2023-04-04 07:45 出处:网络
I\'m setting up some things in XAML, but for some reason, I\'m having an issue. I\'m trying to add an ObjectDataProvider to my resources, but when I\'m doing that, I get this warning on my resourcedic

I'm setting up some things in XAML, but for some reason, I'm having an issue. I'm trying to add an ObjectDataProvider to my resources, but when I'm doing that, I get this warning on my resourcedictionnary saying i cannot have multiple items in a resourcedictionnary if they don't all have key attribute in it. So I add a key to resourcedictionnary, but then I have a problem on my dynamic resource in my contentcontrol. It says it cannot resolve "DefaultEmptyPane". Then I add a reference 开发者_开发知识库to the key of the resourcedictionnary, but then there's some kinda of mismatch.

Is there anyone who's seeing the issue here? Below is the 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>


Jerry, the answer lies in your XAML itself. Did u observe why it gives error for ObjectDataProvider and not for RemoveUnderscoreConverter or NormrequestCalculatedToVisibilityConverter or PopulationNameGetDateConverter etc.?

Observe their placement. They are placed inside the ResourceDictionary tag butObjectDataProvider is outside it.

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消