gpt4 book ai didi

wpf - Visual Studio 2010 - 字典未找到但存在

转载 作者:行者123 更新时间:2023-12-05 01:19:27 25 4
gpt4 key购买 nike

好吧,我正在开发一个 wpf 应用程序,但在设计时遇到了一个奇怪的错误。这是一个 wpf 表单的代码:

<Window x:Class="ViewLayer.Frm_EnrollWaitingList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Frm_EnrollWaitingList" WindowStartupLocation="CenterScreen" BorderBrush="{x:Null}" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="390" Width="410"
WindowStyle="None"
AllowsTransparency="True"
ResizeMode="NoResize">
<Window.Resources>
<ResourceDictionary Source="Dictionary/WaitingListDictorionary.xaml"/>
</Window.Resources>
<Grid>
<Rectangle Margin="0,0,0,0" Name="rectangle1" Stroke="{x:Null}" Fill="#FF8C90AD" Opacity="0.95" />
<Button Style="{DynamicResource CommonButton}" Content="Salir" Height="80" HorizontalAlignment="Left" Margin="166,234,0,0" Name="btn_close" VerticalAlignment="Top" Width="180" />
</Grid>
</Window>

问题从这里开始:
<Window.Resources>
<ResourceDictionary Source="Dictionary/WaitingListDictorionary.xaml"/>
</Window.Resources>
ResourceDictionary退出并在执行时它完美地工作。但是在设计时,当我想在 Visual Studio 设计器中修改表单时,我收到以下错误:
FileNotFoundException An error occurred while finding the resource dictionary "Dictionary/WaitingListDictorionary.xaml".


Unable to find the specified file.
at Microsoft.Windows.Design.Platform.ViewProducerBase.Microsoft.Expression.DesignModel.DocumentModel.IDocumentRootResolver.GetDocumentRoot(String path)
at Microsoft.Expression.Platform.WPF.InstanceBuilders.ResourceDictionaryInstanceBuilder.ProvideResourceDictionary(IInstanceBuilderContext context, DocumentCompositeNode resourceDictionaryReferenceNode, IDocumentRoot& relatedRoot)

而且我无法使用设计器编辑表单。

任何的想法?我在执行时间重复我没有问题。

最佳答案

Source属性是相对的,并且您的窗口似乎在 ViewLayer 目录中,因此 Dictionary如果使用,文件夹也必须在 ViewLayer 目录中

Source="Dictionary/WaitingListDictorionary.xaml".  

如果 Dicionary 文件夹在根级别,请尝试
Source="/Dictionary/WaitingListDictorionary.xaml".

您还可以使用 pack://URL。

关于wpf - Visual Studio 2010 - 字典未找到但存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7768328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com