Helo!
I create in my project a folder named 'Templates'. In this folder I store all my DataTemplates declared in various ResourceDictionary files.
I am attaching it (so it becomes a StaticResource and I can use it everywhere in the<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Templates/ContactTemplate.xaml"/>
<ResourceDictionary Source="/Templates/ProductTemplate.xaml"/>
<ResourceDictionary Source="/Templates/OrderTemplate.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
I have many templates, and in some of theme I want to use another template, e.g. in the OrderTemplate I need to use the ContactTemplate and vice versa.
The problem is that Visual Studio 2008 (Y开发者_JAVA百科es, it works in run-time, and Expression Studio doesn't notify a problem) reports errors about these templates and doesn't want to show the designer (it does compile tho). VS loads the templates in the order as they're merged in the App.xaml file, for example, in the OrderTemplate I may use ContactTemplate but not vice versa. I tried mergin the OrderTemplate individually in the ContactTemplate but then after I do so in various templates, it becomes circular and I get a SO exception.Any experience to share? I need design-time support.
ThanksI don't know if I made the right decision, but I changed the circular references from StaticResource to DymaicResource and everything works fine now.
精彩评论