Frage

I am trying to add a resource dictionary to a user control as follows:

User Control View/AllOrdersView.xaml

UserControl

Resource Dictionary View/AllOrdersViewResources.xaml

ResourceDictionary

Solution Explorer Showing the UserControl and ResourceDictionary

SolutionExplorer

Error Message

Cannot add element to property 'Resources', because the property can have only one child element if it uses an explicit collection tag.

Troubleshooting Steps

War es hilfreich?

Lösung

Your XAML is wrong. This is the right way to merge ResourceDictionaries:

<UserControl.Resources>
    <ResourceDictionary>
       <ResourceDictionary.MergedDictionaries>
           <ResourceDictionary Source="AllOrdersViewResources.xaml"/>
       </ResourceDictionary.MergedDictionaries>

       <!-- More resources here -->
    </ResourceDictionary>
</UserControl.Resources>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top