WPF विषयों में XAML का एक सेट फ़ाइलें प्रत्येक एक ResourceDictionary जो शैली और खाका परिभाषाओं कि आवेदन में इस्तेमाल किया नियंत्रण के लिए लागू रखती युक्त बस कर रहे हैं। एक विषय फ़ाइल ऐसा दिखाई दे सकता: एक WPF आवेदन में विषयों के लिए
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uc="clr-namespace:MyApp.UserControls">
<!-- Standard look for MyUserControl -->
<Style x:Key="Standard" TargetType="{x:Type uc:MyUserControl}">
<Setter Property="Width" Value="22" />
<Setter Property="Height" Value="10" />
</Style>
</ResourceDictionary>
समर्थन स्पष्ट रूप से विधानसभा के लिए निम्न विशेषता जोड़कर सक्षम होना चाहिए:
[assembly: ThemeInfo(
ResourceDictionary.None,
ResourceDictionaryLocation.SourceAssembly
)]
इस WPF निर्देश देगा देखने के लिए एप्लिकेशन के नियंत्रणों का डिफ़ॉल्ट रूप निर्धारित करने के लिए एम्बेडेड संसाधन फ़ाइल थीम \ generic.xaml कहा जाता है।
ध्यान दें कि जब विषय-विशिष्ट शब्दकोशों आवेदन के विधानसभा, शैली और टेम्पलेट संसाधनों की तुलना में अलग फ़ाइलों निहित हैं एक समग्र कुंजी, जो WPF जो विधानसभा नियंत्रण है कि शैली/टेम्पलेट पर लागू होता है शामिल हैं बताता है का उपयोग करना चाहिए । तो पिछले उदाहरण के लिए संशोधित किया जाना चाहिए:।
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uc="clr-namespace:MyApp.UserControls;assembly=MyApp">
<!-- Standard look for MyUserControl in the MyApp assembly -->
<Style x:Key="{ComponentResourceKey {x:Type uc:MyUserControl}, Standard}">
<Setter Property="Width" Value="22" />
<Setter Property="Height" Value="10" />
</Style>
</ResourceDictionary>
स्रोत
2009-02-23 12:15:45
लिंक मर चुका है :(आप लेख याद है – Default