【问题标题】:Navigation Failed. Cannot Locate Resource for ModernTab WPF导航失败。无法找到 ModernTab WPF 的资源
【发布时间】:2020-11-25 20:33:09
【问题描述】:

我在我的应用程序中使用ModernUI。在下面的代码中,我在ModernTab 中有一个“常规”链接,它位于项目PriceSettingsUI 的窗口PriceSettingsView 内。当我运行此应用程序时,会显示PriceSettingsView 窗口,并且链接“常规”也可以正常工作,但是当我在另一个项目中使用PriceSettingsView 时(从菜单单击事件调用),PriceSettingView 窗口正在显示,但是“常规”链接显示以下错误消息:

Navigation Failed. Cannot locate resource

有人可以建议为什么从另一个项目调用视图时它不起作用吗?从另一个项目调用视图时源属性有问题吗?

<mui:ModernWindow x:Class="PriceSettingsUI.PriceSettingsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:mui="http://firstfloorsoftware.com/ModernUI"
        mc:Ignorable="d"
         Style="{StaticResource EmptyWindow}" Title="PriceSettingsView" Height="700" Width="900">
    <Border Margin="0,5,0,0" BorderBrush="{StaticResource Accent}" BorderThickness="1">
        <mui:ModernTab>
            <mui:ModernTab.Links>
                <mui:Link DisplayName="General" Source="/Views/GeneralSettings.xaml"/>
            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Border>
</mui:ModernWindow>

错误信息:

如果有人需要更多信息,请告诉我。

【问题讨论】:

    标签: c# .net wpf xaml modern-ui


    【解决方案1】:

    但是,当我在另一个项目中使用“PriceSettingsView”时(从菜单点击事件调用)PriceSettingView 窗口显示,但链接“常规”给出错误消息“导航失败。找不到资源”。

    您为GeneralSettings 提供一个与当前 项目相关的URI。在原始项目A 中,存在Views 文件夹并包含GeneralSettings 视图,但是当您在另一个项目B 中使用PriceSettingsView 时,文件夹和视图都不存在,因此视图不能得到解决。

    您必须指定相对于包含它的程序集的GeneralSettings 的URI,并引用相应的项目。在 URI 中指定引用的程序集,例如:

    <mui:Link DisplayName="General" Source="/PriceSettingsUI;component/Views/GeneralSettings.xaml"/>
    

    【讨论】:

    猜你喜欢
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多