2016-06-08 4 views
0

Ich habe ein Ressourcen-Wörterbuch, und ich verweise dies in App.xaml wie im folgenden Code funktioniert es gut, aber der gleiche Code gab ich in UserControl.xaml es funktioniert nicht,Usercontrol ist nicht das ResourceDictionary in Universal Windows Phone

<Application.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="/Tutorials/Controls/CustomColumnChooserTheme.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Application.Resources> 

Können Sie uns vorschlagen?

+0

Vielleicht ist der Weg falsch ist? Sollte es nicht relativ sein? Source ist ein Uri - versuche, '../Ihr relativen Pfad 'hinzuzufügen - oder benutze' ms-appx: /// ... 'schema. – Romasz

+0

Der Pfad ist korrekt, ich habe versucht, ms-appx: ///Tutorials/Controls/CustomColumnChooserTheme.xaml und ../../Tutorials/Controls/CustomColumnChooserTheme.xaml funktioniert aber nicht –

Antwort

0

Alles sollte gut funktionieren, habe ich überprüft.

Wenn Ihr Usercontrol innerhalb des Hauptprojektordner abgelegt wird, fügen Sie einfach diesen XAML-Code in Ihre Usercontrol:

<UserControl.Resources> 
    <ResourceDictionary> 
    <ResourceDictionary.MergedDictionaries> 
     <ResourceDictionary Source="/Tutorials/Controls/CustomColumnChooserTheme.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</UserControl.Resources> 
Verwandte Themen