The window is implemented in a subfolder inaccessible to StartUri

New to WPF.

I am only at the beginning of the project project. I defined a really simple testWindow1.xaml window, which is in the tests of the solution subfolder.

In App.xaml, I cannot:

StartupUri="testWindow1.xaml"

(unless I transfer testWindow1.xaml back to the root of the project)

I also tried to define my namespace in the App.xaml tag, but without success this also does not work.

<Application x:Class="MyProject.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:myprojectNS="clr-namespace:MyProject"
             StartupUri="myprojectNS.tests.testWindow1.xaml">

At run time, the exception message complains that you did not find ressource * testWindow1.xaml

+5
source share
1 answer

Try it -

<Application x:Class="MyProject.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:myprojectNS="clr-namespace:MyProject"
             StartupUri="tests\testWindow1.xaml">

You just need to specify a hierarchy.

+10
source

All Articles