开发者

Window implemented in subfolder not avaiable for StartUri

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜