0

Hello I'm using Modern UI for WPF ,I have a page that contains a list with Items as links to other pages(User controls) my problem is when I press a link I have the error

System.IO.IO exception cannot locate resource 'basicpage1.xaml'

I have searched a lot but with no hope.

here is my XAML file for the list page:

<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

mm8
  • 163,881
  • 10
  • 57
  • 88
Ahmed Elsayed
  • 57
  • 1
  • 5

2 Answers2

1

basicpage1.xaml is located in your Pages directory so you should add /Pages to the source:

<mui:Link DisplayName="Item 1" Source="/Pages/basicpage1.xaml"/>
mm8
  • 163,881
  • 10
  • 57
  • 88
0

I just encountered the same kind of problem when setting a Frame Source to a page.

When checking file properties in solution explorer I noticed that VS has put the page file in a subdirectory of the application file (in my case VS named the subdirectory "My Project") so I rewrote

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

to

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

and it solved the problem.

Just check and compare the full path property of application.xaml versus your basicpage1.xaml"

Andre Gotlieb
  • 27
  • 1
  • 7