IO异常无法找到资源'basicpage1.xaml'

时间:2017-08-23 06:02:44

标签: c# wpf xaml modern-ui

您好我正在使用Modern UI for WPF,我有一个页面,其中包含一个列表,其中Items作为其他页面的链接(用户控件)我的问题是当我按下链接时我有错误

  

System.IO.IO异常找不到资源'basicpage1.xaml'

我搜索了很多但没有希望。

这是我的列表页面的XAML文件:

<UserControl x:Class="ModernUINavigationApp.Pages.ListPage1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">

        <mui:ModernTab Layout="List" >
            <mui:ModernTab.Links>
                <!-- TODO: set @Source -->
                <mui:Link DisplayName="Item 1" Source="/basicpage1.xaml"/>
                <mui:Link DisplayName="Item 2" />
            </mui:ModernTab.Links>
        </mui:ModernTab>
    </Grid>
</UserControl>

The Exception

Solution Explorer

2 个答案:

答案 0 :(得分:1)

basicpage1.xaml位于您的Pages目录中,因此您应该将/Pages添加到来源:

<mui:Link DisplayName="Item 1" Source="/Pages/basicpage1.xaml"/>

答案 1 :(得分:0)

我在设置帧源到页面时遇到了同样的问题。

在解决方案资源管理器中检查文件属性时,我注意到VS已将页面文件放在应用程序文件的子目录中(在我的情况下,VS命名为子目录“My Project”),所以我重写了

<Frame Source="/Page1.xaml"/>

<Frame Source="/My Project/Page1.xaml"> 

它解决了这个问题。

只需检查并比较application.xaml与basicpage1.xaml“

的完整路径属性