WPF资源字典问题 [英] WPF Resource Dictionaries problem

查看:198
本文介绍了WPF资源字典问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MSDev 2010/.NET 4/c#,我已经从事了将近一年的项目.从"MSDN控件模板"示例中复制样式,我将所有样式/控件模板都放在字典中-每个控件类型一个字典.然后我引用了 它们放在我的App.xaml中(见下文).一切都很好.

Using MSDev 2010 / .NET 4 / c#, I've been working on a project for almost a year. Copying the style from the MSDN Control Templates example I put all my Styles / Control Templates in dictionaries - one dictionary per control type.  I then referenced them in my App.xaml (See Below).  This all worked fine.

上周,我将这些词典复制到了我正在从事的新项目中.我将它们添加到该新项目的App.xaml中,当应用程序正在运行时,这些样式都可见.但是,当修改各种窗口(和页面)时 在xaml文件中,MSDev突出显示每个"Style =" {StaticResource StyleName}包含蓝色的波浪线,指出"Resource"(样式)"StyleName"无法解决.我不知道是什么原因造成的.

Last week, I COPIED these dictionaries to a new project I'm working on.  I added them to the App.xaml for this new project, and when the application is RUNNING, these styles are all visible.  However, when MODIFYING the various Window (and Page) xaml files, MSDev highlights every "Style="{StaticResource StyleName}" entru om blue squiggly lines, which state that "Resource "StyleName" could not be resolved.  I haven't a clue what could be causing it.

下面是我的App.xaml文件.有什么想法会导致这种情况吗?同样,这些样式中的大多数是从ControlTemplate MSDN示例中复制的,并且在大多数情况下,我只是更改了颜色.这些字典都在 我的另一个项目...

Below is my App.xaml file.  Any ideas what could be causing this?  Again, most of these styles were copied from the ControlTemplate MSDN example, and for the most part, I've just changed colors.  And these dictionaries were all working in my other project...

App.xaml


<Application x:Class="ML600_UserInterface.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"	                 
             StartupUri="MainFrame.xaml" Startup="Application_Startup">   
    <Application.Resources>       
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Dictionaries/ConverterDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ColorDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/SharedDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/BrushDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/LabelDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ExpanderDictionary.xaml"/>
                <!--<ResourceDictionary Source="Dictionaries/ScrollViewerDictionary.xaml"/>-->
                <ResourceDictionary Source="Dictionaries/ScrollBarDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ButtonDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/CheckBoxDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ComboBoxDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/DataGridDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/GroupBoxDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ImageDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ListBoxDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ListViewDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/RadioButtonDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/TextBoxDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/TextBlockDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/SliderDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/ToolTipDictionary.xaml"/>
                <ResourceDictionary Source="Dictionaries/MenuDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>       
    </Application.Resources>    
</Application>

推荐答案

MGScott,

Hi MGScott,

如果您的应用程序可以运行,并且您的应用程序可以正常运行,我想您可以忽略它,也许是由vs2010 WPF设计人员xaml引起的,那是相对的连接:

If your aplication could run, and if your application could run as normal I think you could ignore it, might it casue by vs2010 WPF designer xaml, there is a relative connect:

http://connect.microsoft.com/VisualStudio/feedback/details/505755/xaml-editor-resource-could-not-resolved

另外,您可以共享一个小型应用程序来解决此问题吗?

Additional, could your share a small application could repro this issue?

 

最诚挚的问候


这篇关于WPF资源字典问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆