开发者

Window implemented in subfolder not avaiable for StartUri

开发者 https://www.devze.com 2023-02-25 23:00 出处:网络
A 开发者_开发百科novice question about WPF. I\'m just at the beginning of a draft project. I have define a really simple window testWindow1.xaml, located in the solution subfolder Tests.

A 开发者_开发百科novice question about WPF.

I'm just at the beginning of a draft project. I have define a really simple window testWindow1.xaml, located in the solution subfolder Tests.

In App.xaml I cannot do:

StartupUri="testWindow1.xaml"

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

I have also tried defining my namespace into the App.xaml tag, but without success, this wont work either.

<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 about not finding the ressource *testWindow1.xaml


Try this -

<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 the hierarchy.

0

精彩评论

暂无评论...
验证码 换一张
取 消