मैं अपने App.xaml में कोड की निम्न सेट है:सिल्वरलाइट
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Client.Common;component/Theme/Brushes.xaml"/>
<ResourceDictionary Source="/Client.Common;component/Theme/Fonts.xaml"/>
<ResourceDictionary Source="/Client.Common;component/Theme/CoreStyles.xaml"/>
<ResourceDictionary Source="/Client.Common;component/Theme/SdkStyles.xaml"/>
<ResourceDictionary Source="/Client.Common;component/Theme/MyAppName.xaml"/>
<ResourceDictionary Source="/Client.Common;component/Controls/NavigationPanel.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
NavigationPanel.xaml एक शैली है कि इस तरह दिखता है शामिल हैं:
<Style x:Key="NavigationPanelListBox" TargetType="ListBox">
<Setter Property="Background" Value="{StaticResource DarkBackground}" />
<Lots of XAML>
</Style>
{StaticResource DarkBackground}Brushes.xaml फ़ाइल में परिभाषित किया गया है (यानी पहले आर एसोर्स डिक्शनरी)। इसे
<SolidColorBrush x:Key="DarkBackground" Color="#FF707176" />
संसाधन शब्दकोश में परिभाषित किया गया है।
रनटाइम पर, मैं निम्नलिखित त्रुटि मिलती है:
Cannot find a Resource with the Name/Key DarkBackground [Line: 16 Position: 44]
लाइन नंबर और स्थिति का संदर्भ App.xaml में NavigationPanel.xaml संसाधन शब्दकोश।
मैं ब्रश को अन्य नियंत्रणों से संदर्भित कर सकता हूं, बस शामिल संसाधन शब्दकोश नहीं।
मैं संदर्भ क्यों नहीं दे सकता या यह किसी संसाधन के संदर्भ को क्यों हल नहीं करता है जो विलय संसाधन शब्दकोश के उत्तराधिकारी में उच्च है ?? मुझे यहां क्या समझ नहीं आ रहा है?
यह काम करता है और मैं समझता हूं कि यह अभी क्यों हल हो रहा है लेकिन यह उच्च स्तर के शब्दकोश में कब हल नहीं होता है? मैं आपके उत्तर को सही के रूप में चिह्नित कर रहा हूं, लेकिन अगर आपको पता है कि यह क्यों है तो मुझे स्पष्टीकरण पसंद आएगा। –
इसे एक और धागे में मिला। वंशावली के लिए यहाँ छोड़ रहे हैं। https://social.msdn.microsoft.com/forums/windowsapps/en-US/2be9a5f6-5313-448d-a9d9-296bac42215e/using-style-defined-in-merged-dictionary-from-another-merged-dictionary? फोरम = wpdevelop इस के लिए Kamil Nieweglowski के लिए धन्यवाद और क्रेडिट। – Snouto