开发者

Unable to attach multiple styles in Visual Studio 2008

开发者 https://www.devze.com 2022-12-18 17:55 出处:网络
Helo! I create in my project a folder named \'Templates\'. In this folder I store all my DataTemplates declared in various ResourceDictionary files.

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.

Thanks


I don't know if I made the right decision, but I changed the circular references from StaticResource to DymaicResource and everything works fine now.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号